From: Joe Van Dyk Date: 2004-12-14T05:12:23+09:00 Subject: Rails questions Spent some time this weekend working on a Rails application. It's great stuff, coming from a php/mysql "hack it together" background. But I have a couple questions... 1) I have a controller called "houses". In that, there's an action called "modify". modify's view (modify.rhtml) has a form with an action "save_house". When the user hits submit, modify gets called with id save_house (i.e. /houses/modify/save_house). What I want to have happen is the action "save_house" called. I have another action "new", and new.rhtml has a form with action "create_house", and when the user hits submit, the action "create_house" is called, which is what I want to have happen. I'm not sure why that's not the case with modify. 2) has_and_belongs_to_many question: I have a model "House" that has_and_belongs_to_many "Amenity". Is there a "Best Way(tm)" to display this relationship in the controller/view? The way it works currently: houses_controller#new: @amenities=Amenities.find_all new.rhtml: (loops through @amenities, spits out checkboxes.) house_controller#create: @house = House.new(@params["house"].save @house.amenities.clear @params["amenities"].each do |amenity| # @params["amenities"] is an array of amenity id's that the user selected temp_amenity = Amenities.new temp_amenity.id = amenity @house.amenities << amenity end This seems pretty clumsy to me. Thanks for any input! Joe