Displaying 2 results from an estimated 2 matches for "contents_sect".
2006 May 28
1
ActiveRecord: FK constraints problem
...d
class Content < ActiveRecord::Base
belongs_to :section
end
When I trying to remove some Content which associated with Section I
have an error related to foreigh key violation:
"PGError: ERROR: update or delete on "contents" violates foreign key
constraint "fk_contents_contents_sections" on "contents_sections"
DETAIL: Key (id)=(7) is still referenced from table "contents_sections".
: DELETE FROM contents
WHERE id = 7"
And when I trying to remove Content which belongs to "default_content" of some Section
I have a...
2006 Apr 20
4
ActiveRecord: Many-to-Many problem
I am trying to make many-to-may relationship on classes Section and
Content.
Both Content and Section has:
has_and_belongs_to_many :contents and has_and_belongs_to_many :sections
and I have an exception when trying to access model properties:
"undefined method `add_contents'' for #<Section:0xb745c514>"
def add_content_entry
@section = Section.find(params[:section_id])