• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
rails best pratice from feedback
 

rails best pratice from feedback

on

  • 846 views

this is conclusion about experiences from feedback

this is conclusion about experiences from feedback

Statistics

Views

Total Views
846
Views on SlideShare
517
Embed Views
329

Actions

Likes
0
Downloads
5
Comments
0

7 Embeds 329

http://www.tuohuang.info 166
http://tuohuang.thoughtworkers.org 135
http://www.zhuaxia.com 12
http://tuohuang.info 8
http://feeds2.feedburner.com 5
http://cache.baidu.com 2
http://feeds.feedburner.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • So we can use built -in validation of reviewing model.like validatonpresenence and uniquecann't be the same guy for reviewee and reviewerCompare with code of last slide

rails best pratice from feedback rails best pratice from feedback Presentation Transcript

  • Rails Best Practices From Feedback
  • Move finder to scope or method
  • Move finder to scope or method
  • Use model callback
  • Use model callback
  • Move Model Logic to Model
  • Move Model Logic to Model
  • Overuse route customizations
  • Overuse route customizations
    Using Namespace
    Further , it can be applied to PermissionManagerController
    http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing
  • Metaprogramming
    How about all_cmts,all_hrs,all_employees ….WOW!
  • Metaprogramming
    role.hr?
    Role.all_cmts
  • Law of Demeter
  • Law of Demeter
  • Use virtual attributes
    How come that person doesn’t hold a ‘role’ attribute?
    What if we can do add one?
  • Use virtual attributes
    railscasts.com/episodes/16-virtual-attributes
    railscasts.com/episodes/167-more-on-virtual-attributes
  • Favor helper_method
  • Favor helper_method
  • Favor helper_method
    Maybe …..
  • Move View logic to Helper
  • Move View logic to Helper
  • Replace instance variable with local variable
  • Permission Check
    http://hobocentral.net/
  • Permission Check
    What’s more ..
  • Rails Best Practice Gem
    https://github.com/flyerhzm/rails_best_practices
    http://www.ihower.tw/
  • Thanks