Trying to perform a nested object form. The page loads with no errors, but when I send it, no information gets saved to the organization model.
The SQL call says this ..
Parameters: {"commit" => "save", "action"=>"update","_method"=>"put", "organization"=>{"likes_snacks"=>"0"}, ..
Which is right. The 1 and 0 can be changed properly by flipping on and off the checkbox. But that information is just not saved to the database I guess. Any ideas?
HAML:
- form_for @user do |f|
= f.label :username
= f.text_field :username
.clear
- fields_for :organization do |org| unless @user.organizations.empty?
= org.label :likes_snacks, 'Like snacks?'
= org.check_box :likes_snacks
= f.submit 'save', {class => 'button'}
CONTROLLER:
def edit
@user = current_user
@organization = current_user.organizations.first
end
MODELS:
ORGANIZATION.RB:
has_many :users, :through => :organizations_users
USER.RB:
has_many :organizations, :through => :organizations_users