RailsCasts Pro episodes are now free!

Learn more or hide this

Robert Wünsch's Profile

GitHub User: widescape

Site: www.wowbiz.de

Comments by Robert Wünsch

Avatar

If you don't want to dig through all the modules, use the default:

class Message
  include ActiveModel::Model
end

This is pretty handy, because it already extends Naming and Translation, and includes Validations and Conversion. And it comes with a nifty initializer that allows to pass attributes in Message.new(title: "...") and offers a persisted? method.

See: https://github.com/rails/rails/blob/master/activemodel/lib/active_model/model.rb