I have a problem with a checkbox in the train:
I have two models, users and authorized_users , With the following support:
class authorized users & lt; ActiveRecord :: Base is_on: user, like = & gt; : Useraccount
and:
class user & lt; ActiveRecord :: Base is_to: useraccount,: polymorphic = & gt; True ,: Dependent = & gt; : In the user's "edit" view, a checkbox is required to cheat me, if the authorized_user should receive email (true) or not (false): < Pre> & lt;% = check_box (: authorized_user,: sendEmail, option = {: check = & gt; true}, check_view = true, uncheck_value = false)% & gt;
The same exact code is doing the perfect job in the "new" view of authorized_user, when creating a new user, but when I edit them, the user's "edit "With the view, there is an error in submitting the form, but the boolean cell is not affecting in the database.
Why do I need to amend the fact that when I submit the form, changes are saved?
Thank you very much in advance.
PD: For more information, I can say that the other data is being modified by the user in the "Editing" view with no problem, for exmaple:
<% f.check_box: sendmail%>
suggested by @Marek-lipka
in the user #MethodError # Edit the app / view / user / edit.htmlArab the ARB where the row # 64 Raised up: # & Lt; Users: 0xb5dbd96c & gt; Undefined method for `Send email 'extracted source (around line # 64): 63: & lt; P & gt; ¿Dücel reisir e-mail? / P & gt; 64: & lt; P & gt; & Lt;% = f.check_box: sendEmail% & gt; & Lt; / P & gt; 65: & lt;% end% & gt; 66: & lt; Br / & gt; We got the clue after a long discussion with @Merak-Lipaka: We should use it: useraccount as linker action no more: authorized_user:
& Lt;% = check_box (: useraccount, sendEmail, option = {: check = & gt; true}, checked_value = true, unchecked_value = false)% & gt;
You have this problem because you use real objects while presenting this check box Do not do it. It should probably be:
& lt;% = f.check_box: send_email% & gt;
Note that I used the send_email
name in the Rail Code conference, which you should adopt.
Comments
Post a Comment