Merge pull request #14 from finnlabs/feature/rails3_sti

Feature/rails3 sti
pull/6827/head
Hagen Schink 12 years ago
commit 6e5d1ce83f
  1. 2
      lib/report/filter/base.rb
  2. 2
      lib/report/sql_statement.rb

@ -170,8 +170,6 @@ class Report::Filter
end end
def initialize(child = nil, options = {}) def initialize(child = nil, options = {})
# TODO: wtf?
#raise ArgumentError, "Child has to be a Filter." if child and not child.filter?
@values = [] @values = []
super super
end end

@ -142,7 +142,7 @@ class Report::SqlStatement
join_syntax = "LEFT OUTER JOIN %1$s ON %1$s.id = %2$s_id" join_syntax = "LEFT OUTER JOIN %1$s ON %1$s.id = %2$s_id"
list.each do |e| list.each do |e|
case e case e
when Class then joins << (join_syntax % [table_name_for(e), e.model_name.underscore]) when Class then joins << (join_syntax % [table_name_for(e), e.lookup_ancestors.last.model_name.underscore])
when / / then joins << e when / / then joins << e
when Symbol, String then joins << (join_syntax % [table_name_for(e), e]) when Symbol, String then joins << (join_syntax % [table_name_for(e), e])
when Hash then e.each { |k,v| joins << (join_syntax % [table_name_for(k), field_name_for(v)]) } when Hash then e.each { |k,v| joins << (join_syntax % [table_name_for(k), field_name_for(v)]) }

Loading…
Cancel
Save