Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing save protocol filter error #731

Merged
merged 2 commits into from Nov 16, 2016

Conversation

ying-pbrc
Copy link
Collaborator

Receiving the following errors:

ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attributes for ProtocolFilter: sorted_by):
app/controllers/dashboard/protocol_filters_controller.rb:25:in `new'

@@ -35,6 +35,7 @@ class ProtocolFilter < ActiveRecord::Base
attr_accessible :with_organization
attr_accessible :with_status
attr_accessible :with_owner
attr_accessible :sorted_by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually an attribute on the ProtocolFilter model anymore. We changed the design to do sorting via custom Javascript that calls an AJAX request for Dashboard::ProtocolsController#index.js and it passes the "sorted_by" attribute. I think what we can do instead is in Dashboard::ProtocolFiltersController#new we should reject that attribute from params[:filterrific]

Maybe something like this:
@protocol_filter = @user.protocol_filters.new(params[:filterrific].delete(:sorted_by))

@jleonardw9 jleonardw9 merged commit 86e0aaf into sparc-request:master Nov 16, 2016
@ying-pbrc ying-pbrc deleted the protocol-filter-save-error branch February 13, 2017 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants