Authlogic's current_user object in models

Posted by jriff on Stack Overflow See other posts from Stack Overflow or by jriff
Published on 2010-03-19T10:57:38Z Indexed on 2010/03/19 11:01 UTC
Read the original article Hit count: 194

Filed under:
|

Hi all!

I need to know the ID of the current user in a model:

def after_save
  desc, points=nil, nil

  if answer_index == daily_question.correct_answer_index 
    desc = I18n.t('daily_question.point_log.description.correct') 
    points=daily_question.points
  else
    desc = I18n.t('daily_question.point_log.description.incorrect')
  end

  current_user.give_points(:description => desc,
                           :points => points
                          )
end

But I guess that is not how it is done?

Regards,

Jacob

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about authlogic