Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Please review this change #3

wants to merge 3 commits into from

4 participants


I have used this gem before in a spree application and found it very useful.
So, I tried to use it in a rails 3 App and the Preference model could not be found, so I added a rails engine so that the load paths are added etc..




It seems there are a few of these "make it work with Rails3" pull requests stacking up. Any plans to merge these in? This gem is really useful and the lack of Rails 3 support (especially given the relatively simple changes have been contributed already) is frustrating.




@obrie has indicated in the past that he doesn't have a lot of time to maintain this project. Maybe he can hand it over to someone who does. Like was mentioned earlier, this is a great project and I'm sure lots of people are interested in using it in Rails 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 15, 2011
  1. Added rails 3 engine

    Gary Taylor authored
Commits on Apr 1, 2012
  1. @garytaylor
  2. @garytaylor
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 4 deletions.
  1. +4 −4 lib/preferences.rb
  2. +5 −0 lib/preferences/engine.rb
8 lib/preferences.rb
@@ -1,5 +1,5 @@
require 'preferences/preference_definition'
+require 'preferences/engine'
# Adds support for defining preferences on ActiveRecord models.
# == Saving preferences
@@ -152,7 +152,7 @@ module MacroMethods
#! # => true
def preference(name, *args)
unless included_modules.include?(InstanceMethods)
- class_inheritable_hash :preference_definitions
+ class_attribute :preference_definitions
self.preference_definitions = {}
has_many :stored_preferences, :as => :owner, :class_name => 'Preference'
@@ -160,8 +160,8 @@ def preference(name, *args)
after_save :update_preferences
# Named scopes
- named_scope :with_preferences, lambda {|preferences| build_preference_scope(preferences)}
- named_scope :without_preferences, lambda {|preferences| build_preference_scope(preferences, true)}
+ scope :with_preferences, lambda {|preferences| build_preference_scope(preferences)}
+ scope :without_preferences, lambda {|preferences| build_preference_scope(preferences, true)}
extend Preferences::ClassMethods
include Preferences::InstanceMethods
5 lib/preferences/engine.rb
@@ -0,0 +1,5 @@
+module Preferences
+ class Engine < Rails::Engine
+ end
Something went wrong with that request. Please try again.