class Actor < ActiveRecord::Base
  has_and_belongs_to_many :movies
  has_many :photos, :dependent => :destroy
  validates_presence_of :first_name, :last_name
  validates_format_of :height, :with => /^[0-9]' ([0-9]|1[0-1])"$/,
  :allow_nil => true, :allow_blank => true, 
  :message => 
  " Height in the US is measured as feet (') & inches(\"), i.e 6' 4\", 
    We accept up to 9 feet 11 inches tall actor. Can enter zero inches."
    

  # A METHOD TO CHECK IF A GIVEN ACTOR IS IN A SPECIFIC MOVIE. THIS METHOD
  # WILL BECOME USEFUL WHEN WE ASSOCIATE MOVIES WITH ACTORS (MANY-TO-MANY)
  def involved_in?(movie)
    self.movies.include?(movie)
  end  
  
  # A METHOD TO CHECK MOVIES THE ACTOR IS NOT IN, OUT OF OUR ENTIRE COLLECTION
  # THIS WILL FACILITATE A SELECTION LIST OF MOVIES TO CAST AN ACTOR IN OUR DB
  def not_involved_movies
    Movie.find(:all) - self.movies
  end
  
  # THIS METHOD WILL FACILITATE SELECTION LIST OF FIRST+LAST NAME COMBO
  def full_name
   self.first_name + ' ' + self.last_name
  end
  
end
