Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 2.44 KB | None | 0 0
  1. ruby-1.8.7-p334 :001 > resource_type = ResourceType.find_with_english_label("Place")
  2.  => #<ResourceType id: 1, resource_type_group_id: 1, created_at: "2011-02-08 09:53:07", updated_at: "2011-02-28 08:16:11", position: 1, visible: true>
  3.  
  4. ruby-1.8.7-p334 :002 > user = User.first
  5.  => #<User id: 4, email: "gianni.letta@mailinator.com", encrypted_password: "$2a$10$/NdiUFwB6813.Tco7sU1iOFlANJV4B0HeorU/GTBmRvH...", password_salt: "$2a$10$/NdiUFwB6813.Tco7sU1iO", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2011-04-18 12:50:25", last_sign_in_at: "2011-04-18 12:50:25", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", roles: 2, first_name: nil, last_name: nil, gender_male: nil, birthday: nil, description: nil, cached_slug: "gianniletta", group_memberships_count: 0, resources_count: 0, resource_connections_count: 0, comments_count: 0, shelves_count: 0, cached_votes: 0, created_at: "2011-04-18 12:50:23", updated_at: "2011-04-18 13:01:09", username: "gianniletta", twitter_username: nil, twitter_token: nil, twitter_secret: nil, facebook_username: nil, facebook_secret: nil, facebook_access_token: nil, social_network_options: nil, portlet_preferences: nil, linkedin_username: nil, linkedin_token: nil, linkedin_secret: nil, usage_preferences: nil, profession: nil, company: nil, location: nil, group_creation_limit: 1, last_request_at: "2011-04-18 13:01:09", foursquare_token: nil, foursquare_username: nil, foursquare_id: nil>
  6.  
  7. ruby-1.8.7-p334 :003 > r = Resource.new(:title => "foorby", :author => user, :resource_type => resource_type)
  8.  => #<Resource id: nil, title: "foorby", content: nil, visits: nil, author_id: 4, resource_type_id: 1, public: true, cached_slug: nil, comments_count: 0, cached_votes: 0, created_at: nil, updated_at: nil, in_connections_counter: 0, out_connections_counter: 0>
  9.  
  10. ruby-1.8.7-p334 :004 > r
  11.  => #<Resource id: nil, title: "foorby", content: nil, visits: nil, author_id: 4, resource_type_id: 1, public: true, cached_slug: nil, comments_count: 0, cached_votes: 0, created_at: nil, updated_at: nil, in_connections_counter: 0, out_connections_counter: 0>
  12.  
  13. ruby-1.8.7-p334 :005 > r.add_taggings_for_user("testest", user)
  14.  => ["testest"]
  15.  
  16. ruby-1.8.7-p334 :006 > r.taggings
  17.  => [#<Tagging id: nil, tag_id: 51, resource_id: nil, created_at: nil, updated_at: nil, user_id: 4>]
  18.  
  19. ruby-1.8.7-p334 :007 > r.save
  20. ActiveRecord::ReadOnlyRecord: ActiveRecord::ReadOnlyRecord
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement