I want to display all the available types in radio buttons in order to click and select on of them
= f.collection_radio_buttons :type_id, Type.all, :label => "Available Types"
but I'm getting the following error
wrong number of arguments (given 3, expected 4..6)
How can I fix the collection_radio_buttons
in order to get the correct number of arguments?
Here is the api doc on collection_radio_buttons:
http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormBuilder/collection_radio_buttons
it definitely indicates you need at least 4 arguments (minimum):
method, collection, value_method, text_method, options = {}
You have provided 3 - a method :type_id
a collection Type.all
You've also provided options, but have missed the value_method
and text_method
That's what you need to add to make this work.
What method will be called on each Type
for the text/values of the select-options? Usually this is something like: :id
(for value_method
) and something like :name
(for text_method
)