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

Fixed the questionnaire controller's create action [#136213257] #830

Merged
merged 2 commits into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def create
end

def update
@questionnaire.update_attributes(questionnaire_params)
if @questionnaire.save
if @questionnaire.update(questionnaire_params)
Copy link
Contributor

Choose a reason for hiding this comment

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

Because .update returns the object, rather than a boolean value, which isn't needed here, it might be better to just use .update_attributes.

http://stackoverflow.com/questions/27684038/rails-paperclip-update-vs-update-attributes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.update_attributes is an alias for .update as of 4.0.2
http://apidock.com/rails/v4.0.2/ActiveRecord/Persistence/update_attributes

And .update does return false, but only if the object is invalid.

redirect_to service_additional_details_questionnaires_path(@service)
else
render :edit
Expand Down