redmine_introductions icon indicating copy to clipboard operation
redmine_introductions copied to clipboard

undefined method `find_or_create_by' for #<Class:0x5bd6c94>

Open ghost opened this issue 8 years ago • 1 comments

When I clicked "Replay later" and "Do not show again", my redmine showd Internal Error.

This Error messages:

undefined method `find_or_create_by' for #Class:0x5bd6c94

Backtraces:

/var/www/redmine-269/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.22/lib/active_record/dynamic_matchers.rb:55:in method_missing' /var/www/redmine-269/plugins/redmine_introductions/app/controllers/introductions_controller.rb:66:indo_not_show_again' /var/www/redmine-269/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.22/lib/action_controller/metal/implicit_render.rb:4:in `send_action'

Could you check it ?

I changed the code in the followings. It seems OK.

app/controllers/introductions_controller.rb:

  def do_not_show_again
#    @intro_user = IntroductionsUser.find_or_create_by(introduction_id: params[:introduction_id].to_i, user_id: User.current.id)
    @intro_user = IntroductionsUser.where(introduction_id: params[:introduction_id].to_i, user_id: User.current.id).first_or_create

  def update_last_view_date
#    @intro_user = IntroductionsUser.find_or_create_by(introduction_id: params[:introduction_id].to_i, user_id: User.current.id)
    @intro_user = IntroductionsUser.where(introduction_id: params[:introduction_id].to_i, user_id: User.current.id).first_or_create

Thanks.

ghost avatar May 20 '16 04:05 ghost

And also, Exit button doesn't appear.

Thanks.

ghost avatar May 20 '16 04:05 ghost