In my app, users have a location, and there are users in locations.
user.rb
has_one: accepts place __ nested_attributes_for: location attr_accessible ...: location_attributes location.rb
related_to: user attr_accessible: country,: state, city, address: zipcode, user_id < / Pre> users_controller (users have been automatically created, so there is no new "new" view)
dig editing @user = current_use @ User.bolld_location and users / edit.html.haml
= form_for @user do | F | ... = f.fields_for: location | Location | % P = location.label: country = location.text_field: Country% p = location.label: state = location.text_field: state% p = location.label: city = location.text_field: city% p = location.label: address = Location.text_field: Address% p = location.label: zipcode = location.text_field: zipcode = f.submit I can not find error "protected properties: country, state , City, address, zipcode. "
I can move" unlimited protected features: location_attribute "first error, but there is no problem here.
{"utf8" => "One", "_method" = & gt; "Put", "authentication_token" = 'gtc: = "gt; update", "verb" = & gt; "Whatever", "city" = & gt; "", "Address" = & gt; "", "Zipcode" => ""}}, "Commit" => ; "Update", "Controller" = & gt; "User", "id" = & gt; "219"} Any thoughts that are happening here? I searched for a WHILE, and can not seem to find anyone with this problem ()
This is actually a problem with the updated action in the controller, which is using an administrator flag If user.update_attributes (params [: user], such as: admin)
- oddly for app-specific reasons If I removed that flag then it worked fine. So I had to find a way to work around it - if the update location is being updated without updating the administrator In the case of a bus, anyone is walking in something like this.
No comments:
Post a Comment