Top "Activemodel" questions

A toolkit for building modeling frameworks like Active Record.

LoadError Unable to autoload constant Message

In my app; when I submit form, I get this error: LoadError at /questions Unable to autoload constant Message, expected /…

ruby-on-rails activemodel rails-models mailboxer
How to determine if a record is just created or updated in after_save

The #new_record? function determines if a record has been saved. But it is always false in the after_save …

ruby-on-rails activerecord activemodel
Getting types of the attributes in an ActiveRecord object

I would like to know if it is possible to get the types (as known by AR - eg in …

ruby-on-rails ruby activerecord activemodel
ActiveModel::MissingAttributeError occurs after deploying and then goes away after a while

I have a Rails 3.0.9 app that, once it is deployed, suffers from a bunch of ActiveModel::MissingAttributeErrors that crop up …

ruby-on-rails ruby activemodel
How to setup a one to many relationship?

I have the following models: User (id, name, network_id) Network(id, title) What kind of Rails model assoc do …

ruby-on-rails ruby-on-rails-3 activerecord activemodel
ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes

If I try to execute the following code: hassle = rota.hassles.create(:sender => user1, :receiver => user2, :type => "…

ruby-on-rails activemodel
rails 3:how to generate models for existing database tables

I've configured my database.yml to point to my existing mysql database how can I generate models from it? rails …

ruby ruby-on-rails-3 activemodel
How to implement multiple different serializers for same model using ActiveModel::Serializers?

Let's say you're implementing a REST API in Rails. When serving a collection, you might want to only include a …

ruby-on-rails-3 json rest activemodel
How to access params in the callback of a Rails model?

I have a callback of a model that needs to create a dependent object based on another field entered in …

ruby-on-rails ruby-on-rails-3 activerecord ruby-on-rails-3.2 activemodel