Hi, This is probably easy but I can''t figure it out. How can I generate a unique cookie name: cookies[:rated] = {:value => "yes", :expires => 30.days.from_now} The :rated part needs to be the id of the post in my blog, something like ''post_17''. How can I achieve this? Thanks, Pete -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
assuming you have a instance variable @post that contains the curent post that was voted on, i would guess: cookies["post_" + @post.id] = {:value => "yes", :expires => 30.days.from_now} --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
err ... more precisely unless cookie["rated_post" + @post.id] = "yes" #do rating stuff here .... #then set the cookie cookies["rated_post_" + @post.id] = {:value => "yes", :expires => 30.days.from_now} end though, as this could be easily cheated on, i would suggest to store this information in a "ratings" table and check fi the user has an entry there for the given post ... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thorsten L wrote:> err ... more precisely > > unless cookie["rated_post" + @post.id] = "yes" > #do rating stuff here .... > #then set the cookie > cookies["rated_post_" + @post.id] = {:value => "yes", :expires => > 30.days.from_now} > end > > though, as this could be easily cheated on, i would suggest to store > this information in a "ratings" table and check fi the user has an > entry there for the given post ...Thanks! That works great! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi I''ve got an app that worked pretty well with 3 dispatchers, and now that I added some (time consuming) webservices on top of it, I would like to dedicate a few dispatchers to a specific controller (the webservices one). I came up with this config (using lighttpd. remote is my webservice controller) $HTTP["url"] =~ "^/remote/" { fastcgi.server = ( ".fcgi" => ( "localhost-8003" => ( "host" => "127.0.0.1", "port" => 8003 ) , "localhost-8004" => ( "host" => "127.0.0.1", "port" => 8004 ) ) ) } $HTTP["url"] =~ "^/(?!remote)" { fastcgi.server = ( ".fcgi" => ( "localhost-8000" => ( "host" => "127.0.0.1", "port" => 8000 ) , "localhost-8001" => ( "host" => "127.0.0.1", "port" => 8001 ) , "localhost-8002" => ( "host" => "127.0.0.1", "port" => 8002 ) ) ) } And i''m wondering, is this a good choice ? How would you do that instead (ie not allow slow web services to block accesses to the web app) ? Thanks for any hints Stan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---