Top "Activemodel" questions

A toolkit for building modeling frameworks like Active Record.

How to test a custom validator?

I have the following validator: # Source: http://guides.rubyonrails.org/active_record_validations_callbacks.html#custom-validators # app/validators/email_validator.…

ruby-on-rails testing rspec validation activemodel
" 'nil' is not an ActiveModel-compatible object. It must implement :to_partial_path " error in micropost model

When I attempt to view the user profile page, I get the error above. Here's my show.html.erb code: &…

ruby-on-rails activemodel
Controlling the order of rails validations

I have a rails model which has 7 numeric attributes filled in by the user via a form. I need to …

ruby-on-rails ruby-on-rails-3 validation activemodel
Difference between Active Model, Active Record and Active Resource

Is there anyone who can help me by defining the exact difference between Active Model, Active Record and Active Resource. …

ruby-on-rails-3 rails-activerecord activemodel activeresource
How to generate associations between models

I am wondering how to do the association in Rails correct. First I create a City model and an Organisation. …

ruby-on-rails ruby-on-rails-3.1 activemodel
ActiveModel attributes

How do I get ActiveRecord attributes method functionality? I have this class: class PurchaseForm include ActiveModel::Validations include ActiveModel::Conversion …

ruby-on-rails ruby ruby-on-rails-3 activemodel
How i can write a query inside select in rails

How can I write this query in Ruby on Rails? Query inside a select SELECT id, company_id, (SELECT name …

ruby-on-rails ruby ruby-on-rails-3 activerecord activemodel
Rails 5 throw abort : how do I setup error messages?

Rails has introduced this throw(:abort) syntax, but now how do I get meaningful destroy errors ? For validation errors one …

activemodel ruby-on-rails-5
Rails, using the dirty or changed? flag with after_commit

I heard rails has a dirty/change flag. Is it possible to use that in the after_commit callback? In …

ruby-on-rails ruby-on-rails-3 activemodel
get validations from model

How cat I get list of validations defined in model Example: class ModelName validates_presence_of :field_name validates_inclusion_…

ruby-on-rails validation activemodel