Reputation: 3491
simple question. I'm trying to create a new object for a very basic class
class Article < ActiveRecord::Base
attr_accessor :title, :content
validates :title, :presence => true
validates :content, :presence => true
end
However, when I try to create a new object in the console, the title and content fields always show up as nil
1.9.2-head :021 > a = Article.new(title: "abcdefg", content: "hijklmnop")
=> #<Article id: nil, title: nil, content: nil, created_at: nil, updated_at: nil>
Why can't I create a new object?
Upvotes: 0
Views: 1314