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
set_table_name "ag_board_attributes"

belongs_to :AgBoard




I'm using the standard scaffolding to get this to work, the destroy method is as follows:

def destroy
board = AgBoard.find(params[:id]).destroy
redirect_to :action => 'list'
end


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.