I’m using Rails 3, Devise and Mongoid.
I believe I can accomplish what I need using RESTful Routes but I am not sure how to do it. Let me explain what I have and what I am trying to do.
Let’s say I have two controllers – User and Simpleform.
The Simpleform is a public facing form (no authentication required) that when submitted shows up in a user’s account (when they login).
I have multipul users on the system and each one will see the form submissions that’s specific to them.
So the question is, how do I get the public facing form to submit to a specific user’s account?
As of now the route to fill out a new form looks like this “site.com/simpleform/new”. I think I can use routes to make it look like this “site.com/simpleform/user_id/new” or “site.com/user_id/simpleform/new”. Either variation would work I think. Now when the form is submitted from someone in the public the application knows what user to associate it too because of the user_id in the url.
I think that logic works and RESTful Routes can make it happen, I’m just not sure how to do it.
Each User resource has one associated SimpleForm resource.
So I would think your route would be like:
And routes would look like: