Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Loading in …3
×
1 of 25

rails best pratice from feedback

0

Share

Download to read offline

this is conclusion about experiences from feedback

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

rails best pratice from feedback

  1. 1. Rails Best Practices From Feedback <br />
  2. 2. Move finder to scope or method<br />
  3. 3. Move finder to scope or method<br />
  4. 4. Use model callback<br />
  5. 5. Use model callback<br />
  6. 6. Move Model Logic to Model<br />
  7. 7. Move Model Logic to Model<br />
  8. 8. Overuse route customizations<br />
  9. 9. Overuse route customizations<br />Using Namespace <br />Further , it can be applied to PermissionManagerController<br />http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing<br />
  10. 10. Metaprogramming<br />How about all_cmts,all_hrs,all_employees ….WOW!<br />
  11. 11. Metaprogramming<br />role.hr? <br />Role.all_cmts<br />
  12. 12. Law of Demeter<br />
  13. 13. Law of Demeter<br />
  14. 14. Use virtual attributes<br />How come that person doesn’t hold a ‘role’ attribute?<br />What if we can do add one?<br />
  15. 15. Use virtual attributes<br />railscasts.com/episodes/16-virtual-attributes<br />railscasts.com/episodes/167-more-on-virtual-attributes<br />
  16. 16. Favor helper_method<br />
  17. 17. Favor helper_method<br />
  18. 18. Favor helper_method<br />Maybe …..<br />
  19. 19. Move View logic to Helper<br />
  20. 20. Move View logic to Helper<br />
  21. 21. Replace instance variable with local variable<br />
  22. 22. Permission Check<br />http://hobocentral.net/<br />
  23. 23. Permission Check<br />What’s more ..<br />
  24. 24. Rails Best Practice Gem<br />https://github.com/flyerhzm/rails_best_practices<br />http://www.ihower.tw/<br />
  25. 25. Thanks<br />

Editor's Notes

  • So we can use built -in validation of reviewing model.like validatonpresenence and uniquecann&apos;t be the same guy for reviewee and reviewerCompare with code of last slide
  • ×