Skip to content
This repository was archived by the owner on Aug 17, 2017. It is now read-only.
This repository was archived by the owner on Aug 17, 2017. It is now read-only.

permit do not work properly when value is array #249

@WaKeMaTTa

Description

@WaKeMaTTa

Expected behaviour

Expected to return the permitted params.

params.require(:post).permit([:title, :body])

# Result:
{"title" => "My title", "body" => "My description"}

Actual behaviour

Instead of the expected behaviour i got an empty hash.

params.require(:post).permit([:title, :body])

# Result:
{}

Workarround

Adding * before array it works.

params.require(:post).permit(*[:title, :body])

# Result:
{"title" => "My title", "body" => "My description"}

System configuration

  • Rails version: rails 3.2.22.5
  • Ruby version: ruby 1.9.3p551
  • strong_parameters version: strong_parameters 0.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions