Skip to content

Commit

Permalink
Having an instance methods file was not really needed. Moved to simpl…
Browse files Browse the repository at this point in the history
…e create_grouped_scope_accessor/define_method.
  • Loading branch information
metaskills committed Sep 23, 2008
1 parent cb9f875 commit 621b483
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/grouped_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'grouped_scope/self_grouping'
require 'grouped_scope/association_reflection'
require 'grouped_scope/class_methods'
require 'grouped_scope/instance_methods'
require 'grouped_scope/has_many_association'

module GroupedScope
Expand Down
2 changes: 1 addition & 1 deletion lib/grouped_scope/association_reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ def create_grouped_association
end

end
end
end
8 changes: 7 additions & 1 deletion lib/grouped_scope/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ def grouped_scopes
def grouped_scope(*associations)
create_belongs_to_for_grouped_scope
associations.each { |association| AssociationReflection.new(self,association) }
include InstanceMethods
create_grouped_scope_accessor
end

private

def create_grouped_scope_accessor
define_method(:group) do
@group ||= SelfGroupping.new(self)
end
end

def create_belongs_to_for_grouped_scope
grouping_class_name = 'GroupedScope::Grouping'
existing_grouping = reflections[:grouping]
Expand Down

0 comments on commit 621b483

Please sign in to comment.