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

Unpermitted parameter: :tags #1

Open
sedubois opened this issue Nov 7, 2019 · 0 comments
Open

Unpermitted parameter: :tags #1

sedubois opened this issue Nov 7, 2019 · 0 comments

Comments

@sedubois
Copy link

sedubois commented Nov 7, 2019

I tested this plugin with Administrate 0.12.0 as follows:

# tag_catalog.rb
class TagCatalog
  def self.all
    [
      Tag.new(id: 'tag1', name: 'Tag 1'),
      Tag.new(id: 'tag2', name: 'Tag 2')
    ]
  end

  class Tag
    attr_accessor :id, :name
    def initialize(id:, name:)
      @id = id
      @name = name
    end
  end
end

# dashboard
  ATTRIBUTE_TYPES = {
    ...
    tags: Field::CollectionSelect.with_options(
      collection: proc { TagCatalog.all },
      value_method: :id,
      text_method: :name,
      options: {
        include_blank: 'Please select some tags',
        include_hidden: false,
      },
      multiple: true,
      label: 'Tags'
    ),

The form loads great, but the selected value does not get saved and the logs show Unpermitted parameter: :tags. It appears that the permit method is filtering out this parameter because it's an array (see code).

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

No branches or pull requests

1 participant