static public Method

Base.new(attributes = {})

Constructor method for new resources; the optional attributes parameter takes a Hash of attributes for the new resource.

Examples

my_course = Course.new
my_course.name = "Western Civilization"
my_course.lecturer = "Don Trotter"
my_course.save

my_other_course = Course.new(:name => "Philosophy: Reason and Being", :lecturer => "Ralph Cling")
my_other_course.save

Source Code

# File active_resource/base.rb, line 533
def initialize(attributes = {})
  @attributes     = {}
  @prefix_options = {}
  load(attributes)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.