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

Add configurable name to the error #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/configurable_engine/configurables_controller_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def update
if failures.empty?
redirect_to(action: :show, :notice => "Changes successfully updated")
else
flash[:error] = failures.flat_map(&:errors).flat_map(&:full_messages).join(',')
flash[:error] = failures.map { |c| [c, c.errors] }.flat_map { |c, e|
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add a test for this behavior? Then happy to merge. Also: miss u

Copy link
Author

Choose a reason for hiding this comment

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

You maintain this gem?! I missed that. And you 💙

The spec would need to be inside feature, right? Because I don't see plain controller specs in the codebase.

e.full_messages.map { |m|
"#{c.name} #{m.downcase}"
}
}.join(',')
redirect_to(action: :show)
end
end
Expand Down