SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member skrolikowski's Avatar
    Join Date
    Nov 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating records error

    I was trying out the shortcut technique for Creating Records on page 129.
    The input and output are displayed below.

    Code:
    >> Story.create( :name => 'SitePoint Forums', :link => 
    'http://www.sitepoint.com/forums/')
    
    => #<Story:0x268d2c8 @new_record=false, 
    @attributes={"name"=>"SitePoint Forums", "id"=>2, 
    "link"=>"http://www.sitepoint.com/forums/"}, 
    @errors=#<ActiveRecord::Errors:0x268c328 
    @base=#<Story:0x268d2c8 ...>, @errors={}>>
    I know this is natural, but what's the deal with the errors?

    Thanks!

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh actually, there are no errors. The interactive ruby shell (irb) just prints out the value of your last statement/expression. In this case, it's the newly created story, which is an ActiveRecord model object that has the @errors instance property. And it's an empty list.

    So everything is behaving quite nicely there.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •