Mohammad Sadiq Shaikh
Mohammad Sadiq Shaikh

Reputation: 3200

How to maintain values of variable between multiple action call in rails

I my project I am having varible

id=params[:id]
status=params[:status]
.....

if(!status.nil?)
   if(status='off')
   flag[id]=1
   else
   flag[id]=2
   end
else
   if(flag==1)
    puts off
   else
    puts on
end

Upvotes: 0

Views: 92

Answers (1)

ksol
ksol

Reputation: 12235

If you want to keep a value between requests, using sessions is probably the right way to do it. See this guide for more on the topic.

Upvotes: 3

Related Questions