Results 1 to 10 of 10
Thread: RoR: strange error, please help
Dec 18, 2005, 18:52 #1
- Join Date
- Dec 2005
- 0 Post(s)
- 0 Thread(s)
RoR: strange error, please help
I'm just learning RoR so bear with me.
I have two models, AgBoard and BoardAttribute, with declarations like so:
class AgBoard < ActiveRecord::Base
acts_as_tree rder => "title"
has_one :BoardAttribute, :dependent => true
class BoardAttribute < ActiveRecord::Base
I'm using the standard scaffolding to get this to work, the destroy method is as follows:
board = AgBoard.find(params[:id]).destroy
redirect_to :action => 'list'
If I don't include the :dependent => true option in the has_one relationship I get foreign key constraint errors because it's not deleting the child row first. If I do add it, I get the following error: wrong number of arguments (0 for 1)
I'm pretty ignorant when it comes to rails so I have no idea where to begin looking. Ultimately, all I want is for it to delete the child row correctly when I delete a parent row.
Any help/suggestions would be greatly appreciated.