Skip to content

Instantly share code, notes, and snippets.

@johndavid400
Created June 29, 2011 15:45
Show Gist options
  • Save johndavid400/1054125 to your computer and use it in GitHub Desktop.
Save johndavid400/1054125 to your computer and use it in GitHub Desktop.
ruby-1.9.2-p180 :034 > a = ::Refinery::Article.create :content => "Blah", :title => "Tester"
(0.2ms) SELECT 1 FROM "refinery_articles" WHERE "refinery_articles"."title" = 'Tester' LIMIT 1
SQL (0.8ms) INSERT INTO "refinery_articles" ("author_id", "content", "created_at", "position", "published_at", "title", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["author_id", nil], ["content", "Blah"], ["created_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00], ["position", nil], ["published_at", nil], ["title", "Tester"], ["updated_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00]]
(0.1ms) SELECT 1 FROM "refinery_galleries" WHERE "refinery_galleries"."title" = 'Tester' LIMIT 1
SQL (0.3ms) INSERT INTO "refinery_galleries" ("article_id", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["article_id", 6], ["created_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00], ["title", "Tester"], ["updated_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00]]
(0.2ms) SELECT COUNT(*) FROM "slugs" WHERE "slugs"."sluggable_id" IS NULL AND "slugs"."sluggable_type" = 'Refinery::Article' AND "slugs"."name" = 'tester' AND "slugs"."scope" IS NULL AND "slugs"."locale" = 'en'
(0.1ms) SELECT COUNT(*) FROM "slugs" WHERE "slugs"."name" = 'tester' AND "slugs"."scope" IS NULL AND "slugs"."locale" = 'en' AND "slugs"."sluggable_type" = 'Refinery::Article'
SQL (0.3ms) INSERT INTO "slugs" ("created_at", "locale", "name", "scope", "sequence", "sluggable_id", "sluggable_type") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00], ["locale", :en], ["name", "tester"], ["scope", nil], ["sequence", 1], ["sluggable_id", 6], ["sluggable_type", "Refinery::Article"]]
SeoMetum Load (0.1ms) SELECT "seo_meta".* FROM "seo_meta" WHERE "seo_meta"."seo_meta_type" = 'Refinery::Article' AND "seo_meta"."seo_meta_id" = 6 LIMIT 1
SQL (0.6ms) INSERT INTO "seo_meta" ("browser_title", "created_at", "meta_description", "meta_keywords", "seo_meta_id", "seo_meta_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["browser_title", nil], ["created_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00], ["meta_description", nil], ["meta_keywords", nil], ["seo_meta_id", 6], ["seo_meta_type", "Refinery::Article"], ["updated_at", Wed, 29 Jun 2011 15:44:03 UTC +00:00]]
=> #<Refinery::Article id: 6, title: "Tester", author_id: nil, published_at: nil, content: "Blah", position: nil, created_at: "2011-06-29 15:44:03", updated_at: "2011-06-29 15:44:03">
ruby-1.9.2-p180 :035 > a.forum_topic.posts.create :text => "This is only a test", :user => user
Refinery::ArticleForumTopic Load (0.3ms) SELECT "refinery_article_forum_topics".* FROM "refinery_article_forum_topics" WHERE "refinery_article_forum_topics"."article_id" = 6 LIMIT 1
NoMethodError: undefined method `posts' for nil:NilClass
from /home/jd/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/whiny_nil.rb:48:in `method_missing'
from (irb):35
from /home/jd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:45:in `start'
from /home/jd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:8:in `start'
from /home/jd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment