I need to put an array of checkboxes on a user profile editing form to
allow users to self-select which neighborhoods they are interested in
from the available neighborhoods. But I can’t figure out the syntax to
put in the view to make the neighborhood.id’s translate into actual
Neighborhood objects that makes AR happy.
The error I am getting from the below code is “Neighborhood expected,
got String”. The Neighborhood id’s are coming in just fine, but the
update_attributes() method just sees them as strings with no meaning.
Which would be fine if it would just put them in the DB and not get all
The list of checkboxes looks like this:
<% for hood in @hoods %>
here is the AccountController:
profile viewing or editing
@user = current_user
@hoods = Neighborhood.find(:all, :order=>:name)
return unless request.post?
flash[:notice] = ‘your account was successfully updated.’
redirect_to :action => ‘profile’
render :action => ‘profile’
class User < ActiveRecord::Base
has_and_belongs_to_many :sale_alerts, :class_name => “Neighborhood”
Thanks a Bunch!