Permalink
Browse files

Updated for Rails 3.2

  • Loading branch information...
1 parent 438fac2 commit 76920657a26aa9ab541e8f7b17dfdf4e848242d4 @dim dim committed Jan 23, 2012
Showing with 151 additions and 51 deletions.
  1. +5 −0 .travis.yml
  2. +40 −42 Gemfile.lock
  3. +1 −1 Gemfile.rails-3.0.x
  4. +5 −0 Gemfile.rails-3.1.x
  5. +95 −0 Gemfile.rails-3.1.x.lock
  6. +1 −1 constrainable.gemspec
  7. +4 −7 lib/bsm/constrainable/operation/base.rb
View
@@ -4,4 +4,9 @@ rvm:
- ree
gemfile:
- Gemfile
+ - Gemfile.rails-3.1.x
- Gemfile.rails-3.0.x
+matrix:
+ exclude:
+ - rvm: ree
+ gemfile: Gemfile
View
@@ -8,79 +8,77 @@ PATH
GEM
remote: http://rubygems.org/
specs:
- actionpack (3.1.1)
- activemodel (= 3.1.1)
- activesupport (= 3.1.1)
+ actionpack (3.2.0)
+ activemodel (= 3.2.0)
+ activesupport (= 3.2.0)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.2)
+ journey (~> 1.0.0)
+ rack (~> 1.4.0)
rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.0.2)
- activemodel (3.1.1)
- activesupport (= 3.1.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.0)
+ activesupport (= 3.2.0)
builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.1)
- activemodel (= 3.1.1)
- activesupport (= 3.1.1)
- arel (~> 2.2.1)
+ activerecord (3.2.0)
+ activemodel (= 3.2.0)
+ activesupport (= 3.2.0)
+ arel (~> 3.0.0)
tzinfo (~> 0.3.29)
- activesupport (3.1.1)
+ activesupport (3.2.0)
+ i18n (~> 0.6)
multi_json (~> 1.0)
- arel (2.2.1)
+ arel (3.0.0)
builder (3.0.0)
diff-lcs (1.1.3)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
- json (1.6.1)
- multi_json (1.0.3)
- rack (1.3.5)
+ journey (1.0.0)
+ json (1.6.5)
+ multi_json (1.0.4)
+ rack (1.4.1)
rack-cache (1.1)
rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
- railties (3.1.1)
- actionpack (= 3.1.1)
- activesupport (= 3.1.1)
+ railties (3.2.0)
+ actionpack (= 3.2.0)
+ activesupport (= 3.2.0)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
- rake (0.9.2)
- rdoc (3.11)
+ rake (0.9.2.2)
+ rdoc (3.12)
json (~> 1.4)
- rspec (2.7.0)
- rspec-core (~> 2.7.0)
- rspec-expectations (~> 2.7.0)
- rspec-mocks (~> 2.7.0)
- rspec-core (2.7.1)
- rspec-expectations (2.7.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.7.0)
- rspec-rails (2.7.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.7.0)
- shoulda-matchers (1.0.0.beta3)
- sprockets (2.0.3)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ shoulda-matchers (1.0.0)
+ sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.4)
+ sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
tilt (1.3.3)
- tzinfo (0.3.30)
+ tzinfo (0.3.31)
PLATFORMS
ruby
View
@@ -2,4 +2,4 @@ source "http://rubygems.org"
gemspec
gem "activerecord", "~> 3.0.0"
-gem "activesupport", "~> 3.0.0"
+
View
@@ -0,0 +1,5 @@
+source "http://rubygems.org"
+
+gemspec
+gem "activerecord", "~> 3.1.0"
+
View
@@ -0,0 +1,95 @@
+PATH
+ remote: .
+ specs:
+ constrainable (0.5.1)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ arel (2.2.1)
+ builder (3.0.0)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ json (1.6.5)
+ multi_json (1.0.4)
+ rack (1.3.6)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ shoulda-matchers (1.0.0)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
+ thor (0.14.6)
+ tilt (1.3.3)
+ tzinfo (0.3.31)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ actionpack
+ activerecord (~> 3.1.0)
+ constrainable!
+ rspec
+ rspec-rails
+ shoulda-matchers
+ sqlite3-ruby
View
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.name = "constrainable"
s.summary = "Simple filtering for ActiveRecord"
s.description = "Sanitizes simple and readable query parameters -great for building APIs & HTML filters"
- s.version = '0.5.1'
+ s.version = '0.6.0'
s.authors = ["Dimitrij Denissenko"]
s.email = "dimitrij@blacksquaremedia.com"
@@ -1,5 +1,4 @@
class Bsm::Constrainable::Operation::Base
- extend ActiveSupport::Memoizable
def self.kind
name.demodulize.underscore.to_sym
@@ -27,9 +26,9 @@ def invalid?
end
def clause
- valid? ? _clause : nil
+ return @clause if defined?(@clause)
+ @clause ||= valid? ? _clause : nil
end
- memoize :clause
protected
@@ -38,18 +37,16 @@ def _clause
end
def normalized
- field.convert(parsed)
+ @normalized ||= field.convert(parsed)
end
- memoize :normalized
def attribute
- case field.attribute
+ @attribute ||= case field.attribute
when Proc
field.attribute.call(relation)
else
relation.table[field.attribute]
end
end
- memoize :attribute
end

0 comments on commit 7692065

Please sign in to comment.