Modularizing Rails Apps with Cells

  • Published on

  • View

  • Download


How to use the Gem Cells


<ul><li> 1. Modularizing Rails Apps With Cells Flavia Missi @flaviamissi</li></ul> <p> 2. Installation $gem install cells Gemfile gem'cells' 3. group:test do gem" rspec-cells " end RSpec? 4. $rails g cell tags display create app/cells/tags_cell.rb invokeerb create app/cells/tags/display.html.erb invokerspec create spec/cells/tags_cell_spec.rb </p> <ul><li>$rails g cell CellName actionName</li></ul> <p>Generator 5. Don't use erb? $rails g cell Tags display-e haml 6. class TagsCell 10 .minutes ... 9. It looks like a controller... And it is! Works exactly like one ;) 10. Views </p> <ul><li>Suports rendering other cells </li></ul> <ul><li>Works like Rails default views </li></ul> <ul><li>Are located in app/cells/your_cell_name/ folder </li></ul> <p> 11. "Live long and prosper" %&gt; Rendering Cells 12. What about the Models? </p> <ul><li>Models are not part of a cell </li></ul> <ul><li>Cells are able to interact with a </li></ul> <p> 13. model just like a controller does 14. Inheritance </p> <ul><li>Cells inheritance </li></ul> <ul><li>Views inheritance </li></ul> <p> 15. </p> <ul><li>app <ul><li>cells <ul><li><ul><li>abstract_post/ </li></ul><ul><li><ul><li>index.html.erb</li></ul></li><li> 16. show.html.erb </li></ul></li></ul></li></ul></li><li>post/ </li></ul> <ul><li><ul><li>index.html.erb </li></ul></li></ul> <p>abstract_post_cell.rb 17. post_cell.rb Inheritance 18. Some interesting links </p> <ul><li></li></ul> <p> 19. 20. </p>