ruby on rails - How do you handle 'actions' on resources in a RESTful design, like marking an email read? -


How can you integrate things into a rental design like this?

  • Marking an email
  • Voting on a story
  • Reporting a message as inappropriate
  • < / Ul>

    In addition, how can you do that someone can do a small icon link or button to work without any wizard?

Again, sometimes it seems that your approach is "to take action on processing" Is being moved from "creating another, separate but related resource".

It is easy to vote on a story: a vote resource you can create, review, etc. The same thing with the report can be applied to any object, instead of marking the presented order, instead you have to submit one, etc. The key is how to transform your action into a noun.

Marking an email is a bit different to read What I will do for it Using a virtual feature: Create your own setter methods on your model (for example, mark_as_read =) You get # In the updated action, the parameter will allow the mark_as_read to pass through the array.

To take an example of voting on a story, what you will do is make a vote model, which is related to a story, make a Vote Controller, and it has nested it with stories controller in its root files. Then, you can easily remove different stories from your nested resource routes (passing in your story record).

Note that the resource should not be supported by the database model, although it will be appropriate if you are required to maintain the ability to fully extend the full model, You can modify the story record in


Comments