Hi,
Does anyone know is it possible to have more than one sessions in a web
application? If it is possible, can someone please tell me how can I
acheive this?
Thanks
fries 88
Hi,
Does anyone know is it possible to have more than one sessions in a web
application? If it is possible, can someone please tell me how can I
acheive this?
Thanks
fries 88
Why would you want to do this?
On Jan 14, 2008 1:03 PM, fries 88 [email protected]
wrote:
Posted via http://www.ruby-forum.com/.
–
Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
Ryan B. wrote:
Why would you want to do this?
On Jan 14, 2008 1:03 PM, fries 88 [email protected]
wrote:Posted via http://www.ruby-forum.com/.
–
Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
I kept counters in the session. Then I assigned counters to my page so
that when I first enter the page, I will be able to save and the
subsequent time I enter the same page I will be able to edit the data I
saved previously. I have to do this for many other pages too. So I was
thinking of having one session for a page. But I am not sure if it is
right or possible.
controller:
def find_count
session[:count] ||= 0
session[:count] += 1
if session[:count] == 1
redirect_to :action => 'prod_desc'
else
redirect_to :action => 'update_prod_desc'
end
end
I’m not sure what you’re trying to do but can’t you do:
session[:count]
and then
session[:othercount]
I dont think this is the right way to go about it.
You should have a link to create the data, and then another link to
edit.
You can decide which one shows by checking to see if the data exists
before
doing it.
Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
On Jan 13, 2008, at 9:18 PM, fries 88 wrote:
end
–
One thing you can do is reference each page in the session.
Something like
session[:page_name][:counter]
If you want to automate it completely, you can even do
session[controller_name][action_name][:counter]
though I would probably convert controller_name and action_name to
symbols with
session[controller_name.to_sym][action_name.to_sym][:counter]
On the other hand, if you only want to do manually, you can use a
before filter to set a variable that you then use as the key into the
session hash.
Having said that, Ryan might be onto something. You might want to
step back and re-evaluate your requirements to see if you are
overcomplicating some process.
Peace,
Phillip
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs