Rails missing features

2,353 views

Published on

Our presentation on Israel Rails Conference 2012. Boris talking about what stuff would be nice to see added to next versions of Rails

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,353
On SlideShare
0
From Embeds
0
Number of Embeds
703
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Rails missing features

  1. 1. Rails Missing Features We dont have all the answers but we definitely have some questions. Boris Nadion @borisnadion
  2. 2. Boris Nadiondeveloping software since early 90th working with Rails since 2005 partner at Astrails
  3. 3. the greatest thing
  4. 4. programmer happiness
  5. 5. beautiful code
  6. 6. testing
  7. 7. communitythe best developers community in the world
  8. 8. high quality code the community usually produces
  9. 9. opinionated
  10. 10. saves timenot making the same decisions over and over again
  11. 11. name tables
  12. 12. name controllers
  13. 13. put source files
  14. 14. test the code
  15. 15. queue Rails 4
  16. 16. etc
  17. 17. save time
  18. 18. http://www.flickr.com/photos/genista/929340935/
  19. 19. decisions
  20. 20. “static” pagesPrivacy Policy, Terms of Services, About Us, etc
  21. 21. not static at allcustomers what to change them from time to time
  22. 22. I don’t
  23. 23. basic CMSnot a full featured monster
  24. 24. too many choices
  25. 25. High Voltage Rails Engine for static pageshttps://github.com/thoughtbot/high_voltage
  26. 26. Refinery CMSAn open source Ruby on Rails content management system https://github.com/refinery/refinerycms
  27. 27. BrowserCMS Humane Content Management for Railshttps://github.com/browsermedia/browsercms
  28. 28. ComfortableMexicanSofa Rails 3 CMS Engine https://github.com/comfy/comfortable-mexican-sofa
  29. 29. another ~20 projects worth mentioning
  30. 30. it shouldn’t be a part of the framework!
  31. 31. why?
  32. 32. ERB
  33. 33. HAML
  34. 34. choiceERB is a default
  35. 35. i18nkeeps the texts in separate YAML files
  36. 36. textile or markdown
  37. 37. basic CMS
  38. 38. CORSCross-origin resource sharing
  39. 39. server:http://api.service.com AJAX calls client: http://example.com
  40. 40. Access-Control-Allow-Origin
  41. 41. Rack CORS Middleware https://github.com/cyu/rack-cors
  42. 42. JSON serialization
  43. 43. business logic should be in a model
  44. 44. as_json
  45. 45. class Meaning < ActiveRecord::Base has_many :senses AS_JSON = { only: [:id, :name], methods: [:voiceover_url], include: {senses: Sense::AS_JSON} } AS_JSON_SHORT = {only: [:id, :name]} def as_json(opts = {}) super opts.merge(opts.delete(:short) ? AS_JSON_SHORT : AS_JSON) endend# controllerdef index render(json: collection.to_json(short: true))end
  46. 46. representation should be in a view
  47. 47. Jbuilderhttps://github.com/rails/jbuilder
  48. 48. JSON Builderhttps://github.com/dewski/json_builder
  49. 49. class MeaningsController < InheritedResources::Base respond_to :json actions :indexend# app/views/meanings/index.json.json_buildermeanings collection do |meaning| id meaning.id name meaning.nameend
  50. 50. think
  51. 51. user authentication
  52. 52. OmniAuthhttps://github.com/intridea/omniauth
  53. 53. Devisehttps://github.com/plataformatec/devise
  54. 54. standard de facto
  55. 55. real time web server push
  56. 56. Push Technologies Overviewhttp://astrails.com/blog/2012/10/2/devcon-2012-real-time-web-slides
  57. 57. dumb serverno business logic, no persistence, direct relay
  58. 58. notify push serverRails push server create/update content send updatesclient client client client client client
  59. 59. hosted solutionspusher, pubnub, hydna, and others
  60. 60. channels and messages
  61. 61. pubnub = Pubnub.new(... keys and auth...)pubnub.publish( message: "some-message, preferably JSON", channel: "some-channel-name, preferably secret token")# somewhere on a client side ...PUBNUB.subscribe({ channel : "some-channel-name, preferably secret token", callback : function(message) { console.log("weve got a message", JSON.parse(message)) }});
  62. 62. config.push = :pubnubconfig.push_auth = {...}Rails.push.publish(channel: @post.token, json: @comment)# somewhere on a client side ...$(window).on("push", function(e, channel_name, message) { console.log("new message", channel_name, message);});
  63. 63. pagination
  64. 64. will_paginate vs. Kaminari
  65. 65. infinite scroll
  66. 66. abstraction
  67. 67. a part of the framework
  68. 68. save a lot of time to spend it on...
  69. 69. http://www.flickr.com/photos/grandvelasrivieramaya/3179390917/
  70. 70. http://www.flickr.com/photos/cobalt/6162053776/
  71. 71. Thank you!Slides and video will be published at http://astrails.com/blog Boris Nadion @borisnadion

×