concept helper in category rails

appears as: helpers, helpers, helper, helper
Rails 4 in Action: Revised Edition of Rails 3 in Action

This is an excerpt from Manning's book Rails 4 in Action: Revised Edition of Rails 3 in Action.

The assets, helpers, and mailers directories aren’t part of the MVC paradigm, but they’re also important parts of Rails:

create  app/controllers/projects_controller.rb
invoke  erb
create    app/views/projects
invoke  rspec
create    spec/controllers/projects_controller_spec.rb
invoke  helper
create    app/helpers/projects_helper.rb
invoke    rspec
create      spec/helpers/projects_helper_spec.rb
invoke  assets
invoke    coffee
create      app/assets/javascripts/projects.coffee
invoke    scss
create      app/assets/stylesheets/projects.scss

This code tells the routing for Rails that you have a tickets resource nested inside the projects resource. Effectively, any time you access a ticket resource, you access it within the scope of a project. Just as the resources :projects method gave you helpers to use in controllers and views, this nested resource of tickets within projects gives you the helpers shown in table 5.1. In the table’s left column are the routes that can be accessed, and in the right are the routing helper methods you can use to access them.

Rails 3 in Action

This is an excerpt from Manning's book Rails 3 in Action.

Inside the block for the draw method is the resources method. Collections of similar objects in Rails are referred to as resources. This method defines the routes and routing helpers (such as the edit_purchase_path method) to your purchases resources. Look at table 1.1 for a list of the helpers and their corresponding routes.

Table 1.1. Routing helpers and their routes

Helper

Route

purchases_path /purchases
new_purchase_path /purchases/new
edit_purchase_path /purchases/:id/edit
purchase_path /purchases/:id

This code tells the routing for Rails that you have a tickets resource nested inside the projects resource. Effectively, any time you access a ticket resource, you access it within the scope of a project too. Just as the resources :projects method gave you helpers to use in controllers and views, this nested one gives you the helpers (where id represents the identifier of a resource) shown in table 5.1.