Save query string parameter value to database

hi,

I search google for this question but i did not find any solution for
that.

I want to save parameter value to database. this parameter send by url.

for example:
http://simple-beach-416.heroku.com/code/restserver?fname=cv

I want to save fname value(here “cv”) to database.
how can i do that?

On 7 May 2011 12:17, farhad mahmoodi [email protected] wrote:

I want to save fname value(here “cv”) to database.
how can i do that?

params[:fname] will have the value “cv” in the controller action.

Colin

I generate a controller and call create model method with parameter:

def add_item
Pers1.create(:fname => params[:fn], :lname => params[:ln])
render :text => “Success!”
end

On 7 May 2011 14:22, farhad mahmoodi [email protected] wrote:

I generate a controller and call create model method with parameter:

def add_item
Pers1.create(:fname => params[:fn], :lname => params[:ln])
render :text => “Success!”
end

Sorry, is there a question there?

Colin

this is correct:
http://simple-beach-416.heroku.com/code/restserver?fn=p1&ln=p2

On 8 May 2011 10:32, farhad mahmoodi [email protected] wrote:

this is correct:
http://simple-beach-416.heroku.com/code/restserver?fn=p1&ln=p2

Again, you must ask a question if you want help. All I see is the
‘something went wrong’ message at that url. This comes from your
file public/500.html in your application. If you are asking why a 500
error is occurring then the first question is whether it works ok on
your development pc before you push it to heroku. If it does work ok
there then look at the logs on heroku for more information.

Colin

Your code example shows

params[:fn]

Your example URL has

fname=cv