Skip to content
Browse files

Qualify the initial dataset to select by default only values from one…

… table.
  • Loading branch information...
1 parent 647d922 commit fbc6543f83441a3f7d392a8aa37cc996e2778214 @r-stu31 committed Mar 2, 2012
Showing with 4 additions and 3 deletions.
  1. +1 −1 lib/active_scaffold/actions/core.rb
  2. +3 −2 lib/active_scaffold/actions/nested.rb
View
2 lib/active_scaffold/actions/core.rb
@@ -142,7 +142,7 @@ def custom_finder_options
# Overide this method on your controller to provide model with named scopes
# This method returns a model class or a dataset.
def beginning_of_chain
- active_scaffold_config.model
+ active_scaffold_config.model.qualify
end
# This method returns a model class.
View
5 lib/active_scaffold/actions/nested.rb
@@ -80,10 +80,11 @@ def beginning_of_chain
if nested.association.returns_array?
nested.parent_scope.send("#{nested.association[:name]}_dataset")
elsif nested.child_association[:type] == :many_to_one
- active_scaffold_config.model.where((nested.child_association[:key] || nested.child_association[:left_key]) => nested.parent_id)
+ active_scaffold_config.model.qualify.where((nested.child_association[:key] || nested.child_association[:left_key]) => nested.parent_id)
end
else
- active_scaffold_config.model
+ # specified in actions/core.rb
+ super
end
end

0 comments on commit fbc6543

Please sign in to comment.
Something went wrong with that request. Please try again.