Rails and Flash params?

Better run rake routes users/new is usually a GET, which makes sense, since you're fetching an object. The create action is the only POST, and that maps to users Doing users/new as a POST breaks REST POST data is not allowed on a GET method. Any parameters will be put on the query string in the URL.

Those parameters will still show up in the params hash Edit If you're actually trying to create a user with this REST call, you need to POST to http://localhost:3000/users not http://localhost:3000/users/new Edit Unfortunately I don't know enough about how flash sends POST requests to tell you why your params aren't coming accross. However, if you're trying to get to the form, you definitely need a GET to http://localhost:3000/users/new You say that you can pick up the variable just fine when you do a GET, right? So you don't need to do a POST If you don't want the user to be able to edit the score, then you save the value to a variable in the controller, and when you render the view, you put that value in an non-editable element, like a disabled text box or maybe even just a label Edit If you can figure out how to get your Post data across from Flash to Rails, you'll need to do a POST to users_url and then you can modify your create method to send back the id of the user that was created.

Then when you get that back, you can make another call to edit the user with that id, leaving the score field disabled. Best of luck.

Better run rake routes. /users/new is usually a GET, which makes sense, since you're fetching an object. The create action is the only POST, and that maps to /users.

Doing /users/new as a POST breaks REST. POST data is not allowed on a GET method. Any parameters will be put on the query string in the URL.

Those parameters will still show up in the params hash. Edit If you're actually trying to create a user with this REST call, you need to POST to http://localhost:3000/users, not http://localhost:3000/users/new Edit Unfortunately I don't know enough about how flash sends POST requests to tell you why your params aren't coming accross. However, if you're trying to get to the form, you definitely need a GET to http://localhost:3000/users/new.

You say that you can pick up the variable just fine when you do a GET, right? So you don't need to do a POST. If you don't want the user to be able to edit the score, then you save the value to a variable in the controller, and when you render the view, you put that value in an non-editable element, like a disabled text box or maybe even just a label.

Edit If you can figure out how to get your Post data across from Flash to Rails, you'll need to do a POST to users_url, and then you can modify your create method to send back the id of the user that was created. Then when you get that back, you can make another call to edit the user with that id, leaving the score field disabled. Best of luck.

Yes /user/new is a GET. Could you recommend a way around this? Should I create custom routes for each url, instead of using resources :users – Peter Dec 16 '10 at 17:13 What I'm saying is, /users/new should be a GET, otherwise it breaks REST.So why would you try to do a POST to a GET method?

It doesn't make sense. Why do you want to do a POST? – Samo Dec 16 '10 at 17:16 @Peter: are you trying to create a new user?

If so you need to post to localhost:3000/users and send your post data. – Samo Dec 16 '10 at 17:27 Yes I'm trying to create a new user with a score value that the user got from the flash. I need to get to the new form so the user can fill in there details, along with there score.

I want to do a POST so they can't change there score manually when on the form. – Peter Dec 16 '10 at 17:33 doing a POST to localhost:3000/users still doesn't work, as it's not picking up the variable. This is what I get when I do a debug params: ---!

Map:HashWithIndifferentAccess action: create controller: users – Peter Dec 16 '10 at 17:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions