Hi, How can easily add a "persistant" or sticky parameter to my
routing, eg something like
http://www.mysite.com/controller/action?theme=blah
or
http://www.mysite.com/controller/action?loggedin=1
I don''t want it in the session, because each browser window should have
it''s own settings. I want to add it at the application level and not
have to visit each action to add it on.
The main purpose I have for this is to implement a kind of slimmed down
theme if the site is visited via a special URL (because it''s embedded
in
a frame). However, I don''t want to use a cookie because if the user
visits the site normally then this should show the full theme. I might
have also a similar use for some "cache busting" URLs where I need to
make a page slightly different for some reason, eg admin logged in,
adding "?admin=1" or something trivial to the URL makes it easier to
bust the caching so that this page is different to the standard URL
What''s the easiest way to implement this so that the param remains in
place (sticky) for each URL (once set the first time)
Cheers
Ed W
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Cookies will be your friend here. On Feb 23, 3:13 pm, Ed W <l...-XJavvHiACVh0ubjbjo6WXg@public.gmane.org> wrote:> Hi, How can easily add a "persistant" or sticky parameter to my > routing, eg something likehttp://www.mysite.com/controller/action?theme=blah > orhttp://www.mysite.com/controller/action?loggedin=1 > > I don''t want it in the session, because each browser window should have > it''s own settings. I want to add it at the application level and not > have to visit each action to add it on. > > The main purpose I have for this is to implement a kind of slimmed down > theme if the site is visited via a special URL (because it''s embedded in > a frame). However, I don''t want to use a cookie because if the user > visits the site normally then this should show the full theme. I might > have also a similar use for some "cache busting" URLs where I need to > make a page slightly different for some reason, eg admin logged in, > adding "?admin=1" or something trivial to the URL makes it easier to > bust the caching so that this page is different to the standard URL > > What''s the easiest way to implement this so that the param remains in > place (sticky) for each URL (once set the first time) > > Cheers > > Ed W--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
chrisfarms wrote:> > Cookies will be your friend here. >I don''t see how I can use a cookie which affects only one browser window, but not one in the tab next door? I would actually quite like to know how to do this for other reasons, eg open up a second browser window and log in as a different user without affecting the user I logged in as on a different browser window... If it''s possible then please share Ed W --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
shane-TZUmyyePvl1+q/UQ5lHrp5RCQo7+22LkAL8bYrjMMd8@public.gmane.org
2007-Feb-23 17:15 UTC
Re: Persistant (sticky) URL parameters?
Here''s a snippet of where I do the exact same thing. You have to use
or add your ''sticky_params'' hash to your options hash on all
the
link_to methods on that page.
If you use it all over the place you could probably extend the link_to
method in a better way to directly access a params hash in your
controller that is always appended to your options hash.
<% sticky_params = { "order_by" => ''Name'' ,
"noun_type" =>
@noun_type } %>
<th><%= link_to( ''Name'' , sticky_params )
%></th>
Shane Sizer
On Feb 23, 9:27 am, Ed W <l...-XJavvHiACVh0ubjbjo6WXg@public.gmane.org>
wrote:> chrisfarms wrote:
>
> > Cookies will be your friend here.
>
> I don''t see how I can use a cookie which affects only one browser
> window, but not one in the tab next door? I would actually quite like
> to know how to do this for other reasons, eg open up a second browser
> window and log in as a different user without affecting the user I
> logged in as on a different browser window...
>
> If it''s possible then please share
>
> Ed W
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Ed, did you try using default_url_options method in controller? it should keep all params defined.. best, Bojan Ed W wrote:> Hi, How can easily add a "persistant" or sticky parameter to my > routing, eg something like > http://www.mysite.com/controller/action?theme=blah > or > http://www.mysite.com/controller/action?loggedin=1 > > I don''t want it in the session, because each browser window should have > it''s own settings. I want to add it at the application level and not > have to visit each action to add it on. > > The main purpose I have for this is to implement a kind of slimmed down > theme if the site is visited via a special URL (because it''s embedded in > a frame). However, I don''t want to use a cookie because if the user > visits the site normally then this should show the full theme. I might > have also a similar use for some "cache busting" URLs where I need to > make a page slightly different for some reason, eg admin logged in, > adding "?admin=1" or something trivial to the URL makes it easier to > bust the caching so that this page is different to the standard URL > > What''s the easiest way to implement this so that the param remains in > place (sticky) for each URL (once set the first time) > > Cheers > > Ed W > > > >-- Bojan Mihelac Informatika Mihelac, Bojan Mihelac s.p. | www.informatikamihelac.com -> tools, scripts, tricks from our code lab: http://source.mihelac.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---