Ruby on Rails Saturday, May 24, 2014

mike2r wrote in post #1146887:
> I would use resources, as
> Scott
> suggests, but limit the actions that you really need such as:
>
> resources :dicts, only: [:show]

Now in my case, the action has a "non-standard" name, i.e. ":manage".

Can I use this too in the "only:" array, or should I instead use a
standard action (in this case probably "edit"), which then, inside my
controller, invokes the "manage" method?

From my understanding of the "Rails Routing From The Outside" guide,
routes.rb defines which controller methods are invoked, when a certain
request arrives, and the "resources" definition just creates standard
routes with standard action names for the "common case"
(show/index/edit/....). Did I grasp this correctly?

If I understood this right, I would have two possibilities: Use ab
action name which reflects the purpose of the action (here: 'manage')
and write a special route definition, as Евгений Шурмин suggested above,
or use the standard action names, and use a 'resources' definition. From
a viewpoint of maintainability, what would you consider the better
solution?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b8087ed9cd649044bbdc7045d45d5058%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment