Report abuse


			
class Film < ActiveRecord::Base

  #  ========== 
  #  = Search = 
  #  ==========
  #acts_as_ferret

  #  =============== 
  #  = Validations = 
  #  =============== 

  # we'll be doing db lookups based on the animate_title not the id.
  # both of these params should be unique otherwise neither the db nor the URL schema will work
  validates_uniqueness_of :animate_title
  validates_presence_of   :animate_title, :title

  #  ================ 
  #  = Associations = 
  #  ================ 

  # relates the model to other db tables
  has_many :directions
  has_many :artists, :through => :directions
  #has_and_belongs_to_many :artists


class Artist < ActiveRecord::Base
  has_many :directions
  has_many :films, :through => :directions
  ...

class Direction < ActiveRecord::Base
  belongs_to :artist
  belongs_to :film
end

  create_table "films", :force => true do |t|
    t.column "title", :string, :limit => 128, :default => "", :null => false
    t.column "title_prefix", :string, :limit => 8
    t.column "animate_title", :string, :limit => 128
    t.column "subtitle", :text
    t.column "production_status", :string, :limit => 32
    t.column "date_of_commission", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "date_of_completion", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "copyright_notice", :string, :limit => 128
    t.column "language", :string, :limit => 128
    t.column "running_time", :string, :limit => 10
    t.column "animate_synopsis", :text
    t.column "one_sentence_synopsis", :text
    t.column "short_synopsis", :text
    t.column "long_synopsis", :text
    t.column "master_copy_format", :string, :limit => 32
    t.column "master_copy_colour", :string, :limit => 32
    t.column "video_distribution_format", :string, :limit => 32
    t.column "video_distribution_ratio", :string, :limit => 32
    t.column "video_distribution_standard", :string, :limit => 32
    t.column "video_distribution_sound_type", :string, :limit => 32
    t.column "film_distribution_format", :string, :limit => 64
    t.column "film_distribution_ratio", :string, :limit => 64
    t.column "film_distribution_sound_type", :string, :limit => 64
    t.column "based_upon_adaptation_type", :string, :limit => 32
    t.column "based_upon_author_first_name", :string, :limit => 128
    t.column "based_upon_author_last_name", :string, :limit => 128
    t.column "based_upon_title_of_source", :string, :limit => 128
    t.column "based_upon_type_of_source", :string, :limit => 128
    t.column "based_upon_published_by", :string, :limit => 128
    t.column "based_upon_copyright", :string, :limit => 128
    t.column "based_upon_key_credit", :boolean
    t.column "production_company_website_text", :string, :limit => 128
    t.column "production_company_website_url", :string, :limit => 128
    t.column "production_company_website_title", :string, :limit => 128
    t.column "production_company_website_description", :string, :limit => 128
    t.column "thanks", :text
    t.column "special_thanks", :text
    t.column "very_special_thanks", :text
    t.column "primary_funding", :text
    t.column "other_financial_support", :text
    t.column "process_summary", :text
    t.column "technical_summary", :text
    t.column "history_working_title", :string, :limit => 128
    t.column "history_initial_synopsis", :text
    t.column "history_initial_artist_statement", :text
    t.column "history_priority", :string, :limit => 32
    t.column "music_cue_sheet_filename", :string, :limit => 128
    t.column "music_cue_sheet_priority", :string, :limit => 32
    t.column "editors_notes", :text
    t.column "role_notes", :text
    t.column "thanks_key_credit", :boolean, :default => false
    t.column "special_thanks_key_credit", :boolean, :default => false
    t.column "very_special_thanks_key_credit", :boolean, :default => false
    t.column "created_at", :datetime, :default => Sun Jan 01 00:00:00 EST 2006, :null => false
    t.column "updated_at", :datetime, :default => Sun Jan 01 00:00:00 EST 2006, :null => false
  end

  create_table "artists", :force => true do |t|
    t.column "first_name", :string, :limit => 128, :default => "", :null => false
    t.column "last_name", :string, :limit => 128
    t.column "animate_artist", :string, :limit => 128, :default => "", :null => false
    t.column "company_name", :string, :limit => 128
    t.column "short_biography", :text
    t.column "short_biography_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "full_biography", :text
    t.column "full_biography_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "filmography", :text
    t.column "filmography_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "artist_statement", :text
    t.column "artist_statement_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "cv_file_name", :string, :limit => 128
    t.column "cv_file_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "filmography_file_name", :string, :limit => 128
    t.column "filmography_file_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "photo_file_name", :string, :limit => 128
    t.column "photo_file_date", :string, :limit => 10, :default => "0000-00-00", :null => false
    t.column "personal_website_url", :string, :limit => 128
    t.column "personal_website_text", :string, :limit => 128
    t.column "personal_website_title", :string, :limit => 128
    t.column "personal_website_description", :string, :limit => 128
    t.column "created_at", :datetime, :default => Sun Jan 01 00:00:00 EST 2006, :null => false
    t.column "updated_at", :datetime, :default => Sun Jan 01 00:00:00 EST 2006, :null => false
    t.column "first_name_second_artist", :string, :limit => 128
    t.column "last_name_second_artist", :string, :limit => 128
  end

  create_table "directions", :id => false, :force => true do |t|
    t.column "film_id", :integer, :limit => 4, :default => 0, :null => false
    t.column "artist_id", :integer, :limit => 4, :default => 0, :null => false
    t.column "collaborator", :boolean, :default => false
    t.column "collaborative_nature", :string
    t.column "role", :string, :limit => 128
    t.column "key_credit", :boolean, :default => false
    t.column "credit_id", :integer, :limit => 6
  end