Displaying 1 result from an estimated 1 matches for "workname".
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
...sure what im doing wrong at all.
Scheme.rb
class Scheme < ActiveRecord::Base
validates :schemename, :presence => true
belongs_to :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...