RESTful design

No, it doesn’t necessarily need more actions.

Changing the product’s price? that’s an update Changing its on-hand quantity? That’s an update Changing it’s availability? That’s an update.

You may opt to have two controllers for your products… one for the public pages where the products are displayed and then a different one for product managemet, or you may instead opt to show different views to your customers vs your admins.

You also don’t have to follow the Rails REST pattern if you don’t want to, but it does make things easier once you get the hang of it. It’s important to remember that while the default Rails REST scaffolding maps a model to a controller,

  • A “resource” can be a controller that exists without a model (Sessions)
  • You can have several resources pointing to one model (AvailableProducts, SaleItems)
  • A model doesn’t have to be backed by a database
  • You are allowed to tack on additional methods map.resources :producs, :member => {:approve => :put, :reject => :put}, :collection =>{:available => :get}

Hope that helps some.

Brian Hogan wrote:

Hope that helps some.

It does. Thanks :slight_smile: