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

permit do not work properly when value is array #249

Open
WaKeMaTTa opened this issue Jun 28, 2017 · 0 comments
Open

permit do not work properly when value is array #249

WaKeMaTTa opened this issue Jun 28, 2017 · 0 comments

Comments

@WaKeMaTTa
Copy link

WaKeMaTTa commented Jun 28, 2017

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant