Topic: Does an app have to be 100% Restful?

I'm re-writing one of my apps to be restful.  Two of my tables are stores and addresses where a store has many addresses (and addresses belongs to stores).

I created the stores in a restful manner because I could see how people might want to use that as a resource.  But do addresses have to be done the same way?  An address by itself is pretty useless so I'm thinking that I should just build it the standard way.  Does that make sense or am I not considering something?

Thanks.. very new to all this REST stuff.

Re: Does an app have to be 100% Restful?

Don't feel obligated to make everything 100% RESTful, it is definitely not meant to be used this way. In fact, there is usually at least one non-restful controller in an application.

That said, how does your "normal" way differ from the RESTful way? If it differs from the RESTful approach this can sometimes mean you need to change your models.

Railscasts - Free Ruby on Rails Screencasts

Re: Does an app have to be 100% Restful?

In your particular case I'd do addresses as a nested resource to Stores. I'd also probably create a more detailed model than address, probably something like StoreBranch with further information about that branch, but that might not be necessary smile.

You don't have to have a 100% RESTful app. Some things just don't call for being RESTful, Mailers for example (contact forms, etc.).

vinnie - rails forum admin

Re: Does an app have to be 100% Restful?

Yeah.. come to think of it, there probably won't be an address controller at all so really the only way to do it is to create the model and go.  Vin, I took your advice and made addresses nested within stores.

Right now I have a lot of comments associated with each store and there probably will be a comments controller.  I'm on the fence as to whether that should be restful or not.  So follow-up question.. just because it can be restful, should it be?

Re: Does an app have to be 100% Restful?

viniosity wrote:

Right now I have a lot of comments associated with each store and there probably will be a comments controller.  I'm on the fence as to whether that should be restful or not.  So follow-up question.. just because it can be restful, should it be?

Most likely yes. You will need some way to create comments, correct? In that case you can put a "create" action in the comments controller. The controller doesn't need to have all 7 CRUD actions - just whatever functionality your application needs to supply.

Railscasts - Free Ruby on Rails Screencasts