class TopTravelDestinations::Destination
Attributes
description[RW]
creates “belongs to” relationship to instance of Region
name[RW]
creates “belongs to” relationship to instance of Region
region[RW]
creates “belongs to” relationship to instance of Region
Public Class Methods
all()
click to toggle source
# File lib/top_travel_destinations/destination.rb, line 19 def self.all @@all end
new(destination_hash)
click to toggle source
# File lib/top_travel_destinations/destination.rb, line 8 def initialize(destination_hash) self.create_attributes_from_hash(destination_hash) self.class.all << self end
Public Instance Methods
create_attributes_from_hash(destination_hash)
click to toggle source
# File lib/top_travel_destinations/destination.rb, line 13 def create_attributes_from_hash(destination_hash) destination_hash.each do |key, value| self.send(("#{key}="), value) end end