I am new to rails but have been able to cobble together a pretty decent storefront and taken it live. However, creating a lot of false sessions. Tried to implement a check for user_agent. The problem is that when I issue a "session :off", I'm receiving a "wrong number of arguments (1 for 0)". Turning the session off under the application.rb works fine but as soon as I try to move it to an action within the controller it errors as in
I am new to rails but have been able to cobble together a pretty
decent storefront and taken it live. However, creating a lot of false sessions. Tried to implement a check for user_agent. The problem is that when I issue a "session :off", I'm receiving a "wrong number of arguments (1 for 0)". Turning the session off under the
application.rb works fine but as soon as I try to move it to an action within the controller it errors as in -------------- def cookies_required session :offreturn unless request.cookies["_session_id"].to_s.blank? session[:return_to] = request.request_uri redirect_to(:controller => "store", :action => "cookies_test") return false end
You can't do thus like that. If you want sessions on or off on a per
action basis you need something like
class SomeController < ApplicationController session :off, :if => Proc.new {|request| ... } end
with your proc evaluating to true or false as appropriate Fred
Fred - thanks for the pointer - all better