Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
end
def create
+ # A new rentable must be created and saved whenever we create a new
+ # video. This is so we have a rentable_id to add to the video.
@rentable = Rentable.new
@rentable.save!
- puts "created new rentable with ID: #{@rentable.id}"
@video = Video.new(params[:video])
@video.rentable_id = @rentable.id
if @video.save
class Rentable < ActiveRecord::Base
has_many :coitem
+ belongs_to :video
#validates_presence_of :genre
end
class Video < ActiveRecord::Base
- belongs_to :rentable
+ has_one :rentable
validates_presence_of :director
validates_presence_of :genre