I have some checkboxes inside a form in the view, that values are being sent to the controller by params for the index.
Obs. I am sending the values of the checkboxes of the view index to itself, I need the values of the checkboxes in a variable.
In controler I'm getting the params like this:
@post = params[:checkbox_array]
In the view, you are:
post: <% @post %>
After the page refreshes, the variable with the second value appears:
post: {"2m"=>"1", "2"=>"2", "3m"=>"3"}
I want to just get all the keys or all the values and assign to another variable
As far as I know, it should be something like this in the controller:
@variavel1 = @post.key
or @variavel2 = @post.values
@ post.select, @ post.sample ... also does not work, when I access the page I get "undefined method"
What should I do to filter this hash I'm getting and have an output like: