Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

putting conditions on the target, not the join model

  • Loading branch information...
commit 51f9225361b63a97e91abbe73f1321d7acb266ad 1 parent 41c86f7
@emschwar emschwar authored
Showing with 56 additions and 73 deletions.
  1. +6 −10 Gemfile
  2. +48 −61 Gemfile.lock
  3. +2 −2 app/models/owner.rb
View
16 Gemfile
@@ -1,9 +1,9 @@
source 'http://rubygems.org'
-gem 'rails', '3.1.0.rc5'
+# gem 'rails', '3.0.10'
# Bundle edge Rails instead:
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
+gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
@@ -11,15 +11,11 @@ gem 'json'
# Gems used only for assets and not required
# in production environments by default.
-group :assets do
- gem 'sass-rails', "~> 3.1.0.rc"
- gem 'coffee-rails', "~> 3.1.0.rc"
- gem 'uglifier'
-end
-
-gem 'jquery-rails'
-gem 'rspec-rails', '>=2.0.0'
+group :test do
+ gem 'jquery-rails'
+ gem 'rspec-rails', '>=2.0.0'
+end
# Use unicorn as the web server
# gem 'unicorn'
View
109 Gemfile.lock
@@ -1,57 +1,70 @@
-GEM
- remote: http://rubygems.org/
+GIT
+ remote: git://github.com/rails/rails.git
+ revision: 2f88743c30ef3dcc7616a6cf18331b84372172b8
specs:
- actionmailer (3.1.0.rc5)
- actionpack (= 3.1.0.rc5)
+ actionmailer (3.2.0.beta)
+ actionpack (= 3.2.0.beta)
mail (~> 2.3.0)
- actionpack (3.1.0.rc5)
- activemodel (= 3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
+ actionpack (3.2.0.beta)
+ activemodel (= 3.2.0.beta)
+ activesupport (= 3.2.0.beta)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
- rack (~> 1.3.1)
+ rack (~> 1.3.2)
rack-cache (~> 1.0.2)
rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
- sprockets (~> 2.0.0.beta.12)
- activemodel (3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
+ sprockets (~> 2.0.0.beta.14)
+ activemodel (3.2.0.beta)
+ activesupport (= 3.2.0.beta)
bcrypt-ruby (~> 2.1.4)
builder (~> 3.0.0)
i18n (~> 0.6)
- activerecord (3.1.0.rc5)
- activemodel (= 3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
- arel (~> 2.1.4)
+ activerecord (3.2.0.beta)
+ activemodel (= 3.2.0.beta)
+ activesupport (= 3.2.0.beta)
+ arel (~> 2.2.1)
tzinfo (~> 0.3.29)
- activeresource (3.1.0.rc5)
- activemodel (= 3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
- activesupport (3.1.0.rc5)
+ activeresource (3.2.0.beta)
+ activemodel (= 3.2.0.beta)
+ activesupport (= 3.2.0.beta)
+ activesupport (3.2.0.beta)
+ i18n (~> 0.6)
multi_json (~> 1.0)
- arel (2.1.4)
+ rails (3.2.0.beta)
+ actionmailer (= 3.2.0.beta)
+ actionpack (= 3.2.0.beta)
+ activerecord (= 3.2.0.beta)
+ activeresource (= 3.2.0.beta)
+ activesupport (= 3.2.0.beta)
+ bundler (~> 1.0)
+ railties (= 3.2.0.beta)
+ railties (3.2.0.beta)
+ actionpack (= 3.2.0.beta)
+ activesupport (= 3.2.0.beta)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ arel (2.2.1)
bcrypt-ruby (2.1.4)
builder (3.0.0)
- coffee-rails (3.1.0.rc.6)
- coffee-script (>= 2.2.0)
- railties (~> 3.1.0.rc1)
- coffee-script (2.2.0)
- coffee-script-source
- execjs
- coffee-script-source (1.1.2)
- columnize (0.3.2)
+ columnize (0.3.4)
diff-lcs (1.1.2)
erubis (2.7.0)
- execjs (1.2.4)
- multi_json (~> 1.0)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.13)
railties (~> 3.0)
thor (~> 0.14)
json (1.5.3)
- linecache (0.43)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -69,23 +82,9 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
- rails (3.1.0.rc5)
- actionmailer (= 3.1.0.rc5)
- actionpack (= 3.1.0.rc5)
- activerecord (= 3.1.0.rc5)
- activeresource (= 3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
- bundler (~> 1.0)
- railties (= 3.1.0.rc5)
- railties (3.1.0.rc5)
- actionpack (= 3.1.0.rc5)
- activesupport (= 3.1.0.rc5)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.6)
rake (0.9.2)
- rdoc (3.9.2)
+ rbx-require-relative (0.0.5)
+ rdoc (3.9.3)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -104,36 +103,24 @@ GEM
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
- sass (3.1.7)
- sass-rails (3.1.0.rc.5)
- actionpack (~> 3.1.0.rc1)
- railties (~> 3.1.0.rc1)
- sass (>= 3.1.4)
- sprockets (>= 2.0.0.beta.9)
sprockets (2.0.0.beta.14)
hike (~> 1.2)
rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
+ tilt (!= 1.3.0, ~> 1.1)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
- uglifier (1.0.1)
- execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
- coffee-rails (~> 3.1.0.rc)
jquery-rails
json
mysql2
- rails (= 3.1.0.rc5)
+ rails!
rspec-rails (>= 2.0.0)
ruby-debug
- sass-rails (~> 3.1.0.rc)
- uglifier
View
4 app/models/owner.rb
@@ -1,6 +1,6 @@
class Owner < ActiveRecord::Base
- has_many :join_models, :dependent => :destroy, :include => :target, :conditions => "targets.active = 't'"
- has_many :targets, :through => :join_models
+ has_many :join_models, :dependent => :destroy, :include => :target
+ has_many :targets, :through => :join_models, :conditions => {:active => true}
scope :for_targets, lambda { |target_name|
select("DISTINCT owners.*").
Please sign in to comment.
Something went wrong with that request. Please try again.