Upgrade to Pro — share decks privately, control downloads, hide ads and more …

shinosakarb #11 Rails 4 Pattenrs

shinosakarb #11 Rails 4 Pattenrs

D8cd979e90361eb5ca5414dd15b35d0f?s=128

murajun1978

December 20, 2014
Tweet

Transcript

  1. Rails 4 Patterns Shinosaka.rb #11

  2. me @murajun1978

  3. Rails 4.2.0 has been released!

  4. new goodies ActionMailer #deliver_later Active Job Web Console Good! Adequate

    Record
  5. Agenda • ActiveRecord::Callbacks • Scope • ActiveSupport::Concern • Decorator •

    ActiveDecorator vs Draper • Helper
  6. Fat Controller

  7. Fat Controller

  8. ActiveRecord::Callbacks

  9. Scope NoMethodError!!

  10. Scope

  11. Scope

  12. Fat Model

  13. ActiveSupport::Concern app/models/concerns/… Class method duplicate :(

  14. Decorator ActiveDecorator view logic… :( $ rails g decorator Post

    app/decorators/…
  15. Decorator Which do you like? ActiveDecorator Draper https://github.com/drapergem/draper https://github.com/amatsuda/active_decorator

  16. Helper content_tag_for <tr id="post_123" class=“post ..”>…</tr> http://localhost/posts#post_123