Tuesday, 15 January 2013

ruby on rails - Wrong number of arguments (2 for 4) using simple_form checkboxes -


I'm a bit confused by the read-me-simple about the collection of checkboxes. That is, what do I expect to put on the additional line of my options? In the readmeem : first, is the last but in reality the words of those words have not been explained.

The checkboxes given below are two different collections I want to make. I should also mention that each checkbox is related to boolean field in DB and labeled them as column names.

  & lt;% = f.collection_check_boxes: option, [[wrong, 'app'], [wrong, 'db'], [false, 'wcf']]%> & Lt;% = f.collection_check_boxes: option, [[wrong, 'com1'], [wrong, 'com2'], [wrong, 'boffa']]%>   

I forgot to mention the error when trying to load this page

  Wrong number of arguments (2 to 4) < / Code>   

This error means that your & lt;% = f.collection_checkboxes % & Gt; takes 2 arguments, but giving it 4. Remember this for future reference because this mistake can be easily created.

From this example given below:

  form_for @user do | F | F.collection_check_boxes (: option, [[true, 'yes'], [wrong, 'no']] :: first, last: what to do. B B.label {b.check_box + b.text} End End   

The rubydoc.info website states the following:

It is also possible to give a To wrap up the check box with the label which should produce the check box + label which blocks: For example:

In this way I think : first and : last as the label it represented. So that you have two check boxes. This is either true or false , but then outside of that option, you are providing labels to those examples, which are examples of class. So take this example. This label is providing example : first and : last category user . Hopefully it clarifies things that the link is given below:



No comments:

Post a Comment