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

Always use proxy param_key when building forms #3424

Closed
wants to merge 3 commits into from
Closed
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
12 changes: 2 additions & 10 deletions lib/active_admin/resource/naming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module ActiveAdmin
class Resource

module Naming
delegate :param_key, to: :resource_name

def resource_name
@resource_name ||= begin
as = @options[:as].gsub /\s/, '' if @options[:as]
Expand All @@ -26,16 +28,6 @@ def plural_resource_label(options = {})
default: resource_label.pluralize.titleize}
resource_name.translate defaults.merge options
end

# Forms use the model's original `param_key`, so we can't use our
# custom `resource_name` when the model's been renamed in ActiveAdmin.
def param_key
if resource_class.respond_to? :model_name
resource_class.model_name.param_key
else
resource_name.param_key
end
end
end

class Name < ActiveModel::Name
Expand Down