Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

class_eval less

  • Loading branch information...
commit e849b727a5d223b24f603066af08526a1afdb83e 1 parent 0d41c1f
@jackdempsey authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/sequel_polymorphic/sequel_polymorphic.rb
View
10 lib/sequel_polymorphic/sequel_polymorphic.rb
@@ -54,11 +54,11 @@ def one_to_many(*args, &block)
options ||= {}
many_class = many_of_class.to_s.singularize
if able = options[:as]
+ associate(:one_to_many, many_of_class, :key=>"#{able}_id".to_sym) do |ds|
+ ds.filter("#{able}_type".to_sym=>self.to_s)
+ end
+
method_definitions = %{
- associate(:one_to_many, :#{many_of_class}, :key=>:#{able}_id) do |ds|
- ds.filter(:#{able}_type=>'#{self}')
- end
-
private
def _add_#{many_class}(#{many_class})
@@ -92,7 +92,7 @@ def many_to_many(*args, &block)
through_klass = through.to_s.singularize.capitalize # => Tagging
associate(:many_to_many, many_to_class,
:left_key => "#{able}_id".to_sym,
- :join_table => through) { |ds| ds.filter("#{able}_type".to_sym=>self.class.to_s) }
+ :join_table => through) { |ds| ds.filter("#{able}_type".to_sym=>self.to_s) }
method_string = %{
private
Please sign in to comment.
Something went wrong with that request. Please try again.