Displaying 1 result from an estimated 1 matches for "schemes_work".
Did you mean:
schemes_works
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
...:user
has_many :levels, :dependent => :destroy
has_and_belongs_to_many :works
end
Work.rb
class Work < ActiveRecord::Base
validates :workname, :presence => true
belongs_to :user
belongs_to :unit
has_many :marks
has_and_belongs_to_many :schemes
end
migration for schemes_works
class CreateSchemesWorks < ActiveRecord::Migration
def self.up
create_table :schemes_works, :id => false do |t|
t.references :scheme
t.references :work
end
THE ERROR
>> scheme = Scheme.last
=> #<Scheme id: 21, schemename: "another", colour: nil, share: ni...