NoMethodError in StatusesController#create
I get the following error when trying to update my status, either within a project or from the Update status link at the very top.
NoMethodError in StatusesController#create undefined method `members' for #<0x8b35170>0x8b35170>
even i m getting the same error as above , any help will be appreciated, thanks
undefined method `members' for #ActiveRecord::Associations::BelongsToAssociation:0xb64a4028
RAILS_ROOT: /home/icicle/roysites/redmine Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"commit"=>"Save", "authenticity_token"=>"Rq2MhZKKQ092epihnGqnQ6by72MpQS4fgNV+7bhNobo=", "status"=>{"project_id"=>"14", "message"=>"testing status update plugin"}}
Show session dump Response
Headers:
{"Content-Type"=>"", "Cache-Control"=>"no-cache"}
I had this problem too. Seems to have been caused by attr_protected :project_id, though I'm not sure why, because the status.project_id was being set explicitly. I'm going to chalk it up to an old Rails 2.3 bug perhaps.
I was able to fix it by removing attr_projected :project_id. This isn't generally advised and leaves a security vulnerability in terms of allowing people to post statuses to projects they don't belong to.
Just to be safe, I added Status.new(params[:status].reject{ |k,v| k == :project_id }) to manually remove :project_id from the mass assignment params, even though it wasn't needed since status.project_id is being overridden by the check_project_id method.
Once I fixed that, I got another exception on the /statuses page due to incorrect project identifier usage, which I also ended up fixing.
TL;DR I fixed these two issues in the create-status-fix branch of my fork.