model view controller - Retriving data from form params is not possible in ruby on rails -


in ruby on rails application

in controller have 2 action methods,first 1 load data , second 1 saving data. 

at first wrote 2 different views both action methods follows

def index ------- end 

and corresponding view follows..

<%= form_tag :action=>:save %>  -------   <%= text_field_tag  templateitem.name %>    ------  ------ <%= submit_tag "save"%> <%end%> 

like above consists input items radiobutton, checkbox ..etc

the other action method follows ,in data read view , saved database

def save  --here read parameter values follows    templateitem.value=params[templateitem.name]  end 

then wrote view saved data works fine.

but requirement saved data load in same index page included code written in save view included in index page save action method changed follows

 def save  --here read parameter values follows    templateitem.value=params[templateitem.name]  --- saved database   return  redirect_to :action => 'index',:encounterid=>1   end 

then not worked , found problem here there no data reading view redirects next view mentioned above action method, didn't find solution problem please me solve this..

params passed. after redirecting destroyed. not accessible in index action


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -