rails : Using params in another action -


i have 3 models, survey -> question -> answer related has_many/belongs_to , nested_form.

i can params in create(post) action.

 "questions"=>{"11"=>{"answer"=>"40"}, "10"=>{"answer"=>"37"}, "9"=>{"answer"=>"31"}} 

i want show user's input in show(get) action. let's assume u taking online test. if u done it, u going submit form, , web server returns result page input.

i thought save hashes in create action , use them in show action. searching google , stackoverflow, realized that's not idea. how can use params in show action?

in create action you're presumably saving data in param database, why not call in show action?

in controller:

@questions = question.all 

in view:

<% @questions.each |question| %>   <h4><%= question.content %></h4>     <% question.answers.each |answer| %>       <%= answer.content %>     <% end %> <% end %> 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -