Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2014 14:28
Show Gist options
  • Save anonymous/de052aefaa63cc7fcf3e to your computer and use it in GitHub Desktop.
Save anonymous/de052aefaa63cc7fcf3e to your computer and use it in GitHub Desktop.
gustavo@gustavo-Inspiron-3421:~/Libbib$ rails console
Loading development environment (Rails 4.1.6)
2.1.3 :001 > Center.all.first
Center Load (0.2ms) SELECT "centers".* FROM "centers" ORDER BY "centers"."id" ASC LIMIT 1
=> #<Center id: 1, email: "isabel.fantoni@gmail.com", encrypted_password: "$2a$10$rhPL.zPs1Caolldc11305ehTaGWD3/8b1ymDRlorJy4...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 2, current_sign_in_at: "2014-10-06 14:32:03", last_sign_in_at: "2014-10-06 14:31:31", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2014-10-06 14:31:31", updated_at: "2014-10-06 14:32:03">
2.1.3 :002 > Book.all.first
Book Load (0.1ms) SELECT "books".* FROM "books" ORDER BY "books"."id" ASC LIMIT 1
=> #<Book id: 1, title: "Planificación estratégica de la imagen corporativa", author: "Paul Capriotti", description: "...", standard_number: 8434412756, pages: 255, publisher: "Ariel", year_published: 1999, created_at: "2014-10-07 14:01:39", updated_at: "2014-10-07 14:01:39">
2.1.3 :003 > a = Center.all.first
Center Load (0.7ms) SELECT "centers".* FROM "centers" ORDER BY "centers"."id" ASC LIMIT 1
=> #<Center id: 1, email: "isabel.fantoni@gmail.com", encrypted_password: "$2a$10$rhPL.zPs1Caolldc11305ehTaGWD3/8b1ymDRlorJy4...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 2, current_sign_in_at: "2014-10-06 14:32:03", last_sign_in_at: "2014-10-06 14:31:31", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2014-10-06 14:31:31", updated_at: "2014-10-06 14:32:03">
2.1.3 :004 > a.book
NoMethodError: undefined method `book' for #<Center:0x00000005ff3d90>
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/activemodel-4.1.6/lib/active_model/attribute_methods.rb:435:in `method_missing'
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/activerecord-4.1.6/lib/active_record/attribute_methods.rb:211:in `method_missing'
from (irb):4
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/railties-4.1.6/lib/rails/commands/console.rb:90:in `start'
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/railties-4.1.6/lib/rails/commands/console.rb:9:in `start'
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:69:in `console'
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/gustavo/.rvm/gems/ruby-2.1.3/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
2.1.3 :005 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment