Looks like this method doesn\'t work anymore in rails 3.1. So, does someone have a working solution?
Actually, I\'ve found this gist. It solves problems with colum
The simplest tableless model in Rails 3.1 is:
class Session
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :email, :password
validates :email, :presence => true
validates :password, :presence => true
def initialize(attributes = {})
if attributes
attributes.each do |name, value|
send("#{name}=", value)
end
end
end
def persisted?
false
end
end
The ActiveModel::Validations is optional (only if validations are used). Also the constructor is not required (but highly desireable).