Top "Activemodel" questions

A toolkit for building modeling frameworks like Active Record.

What is the ActiveModel method attribute "_was" used for?

When using autocomplete in the console, I often see "_was" postpended to my attributes. But I can't find any documentation …

ruby-on-rails ruby activerecord activemodel
Detecting if value of attribute changed during last update doesnt work with Active Model Dirty

I am trying to send a notification email in my rails app only if the value of my column status …

ruby-on-rails controller attributes activemodel
Track dirty for not-persisted attribute in an ActiveRecord object in rails

I have an object that inherits from ActiveRecord, yet it has an attribute that is not persisted in the DB, …

ruby-on-rails-3 activerecord activemodel
Translate model nested attribute validation message

I have a nested attribute on which I perform presence validation. I am trying without success to provide translations for …

ruby-on-rails activemodel rails-i18n
Rails Undefined Method 'model_name'

I have the following model: class Contact attr_accessor :name, :emails, :message def initialize(attrs = {}) attrs.each do |k, v| …

ruby-on-rails-3 activemodel
How to create ActiveRecord tableless Model in Rails 5?

I tried create new model which has auto type casting without table in database. I've tried to inherit from ActiveRecord::…

ruby-on-rails ruby activerecord ruby-on-rails-5 activemodel
Ruby on Rails 3 (3.1) ActiveModel Associations (tableless nested models)

How to impliment ActiveModel associations (tableless nested models)? For example: book has many chapters With ActiveRecord I would create two …

ruby-on-rails-3 activemodel
Where are Default Validation Error Messages in Rails 3.0?

Where are the default validation error messages in Rails 3.0? What is the equivalent of ActiveRecord::Error.default_error_messages[:taken], …

ruby-on-rails validation ruby-on-rails-3 activemodel
Shared scopes via module?

I want to DRY up several models by moving shared scopes into a module, something like: module CommonScopes extend ActiveSupport::…

ruby-on-rails activerecord rspec scope activemodel
Getting actual array of results using Mongoid

With a regular ActiveRecord/SQL setup in Rails, in console when I execute commands *.where, *.all etc., I get back …

ruby-on-rails-3 mongoid activemodel