So I figured out the issue, but now I am wondering if setting this
variable here isn't a good idea, but rather doing it in a helper or
somewhere else?
I am using AuthenticatedSystem and it has a function current_user which
of cource gets the current user. So in my Application controller where
I am setting my @user_interests variable it some how doesn't have access
to that function I guess. So as I created this function in the
ApplicationController and it all works now.
def cur_user
User.find(session[:user_id]) if session[:user_id]
end
So now my ApplicationController code looks like this:
class ApplicationController < ActionController::Base
include AuthenticatedSystem
helper :all # include all helpers, all the time
session :session_key => '_inchs_session'
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => 'eefa7eded747690e8efdb2044a729b4f'
before_filter :login_from_cookie
before_filter :find_user_interests
protected
def find_user_interests
@user_interests = cur_user ? cur_user.interests : []
logger.debug "Person attributes hash: #{current_user.inspect}"
end
def cur_user
User.find(session[:user_id]) if session[:user_id]
end
end
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.