#models
3 posts tagged models. Clear filter
-
Reusing Scopes (Formerly Named_scope) In Rails 3
You can easily chain scopes together in your models. class Article < ActiveRecord::Base scope :ordered, order('position ASC') scope :published, ordered.where('published = ?', true) scope...
-
Load All ActiveRecord::Base Model Classes in Rails Application
Here is a simple rake task which will instantiate all of your Active Record models, provided that they are located in the RAILS\ROOT/app/models directory. Interestingly, all plugin models are...
-
Validate Uniqueness on Join Tables in Rails
How to validate uniqueness in a :has\many :through relationship with Ruby on Rails. You'll need three models in this example List, Subscriber and ListSubscriber. A list has many subscribers and a...