Module: ReputationSystem::FinderMethods::ClassMethods
- Defined in:
- lib/reputation_system/finder_methods.rb
Instance Method Summary collapse
- #count_with_reputation(*args) ⇒ Object
- #find_with_normalized_reputation(*args) ⇒ Object
- #find_with_reputation(*args) ⇒ Object
- #find_with_reputation_sql(*args) ⇒ Object
Instance Method Details
#count_with_reputation(*args) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/reputation_system/finder_methods.rb', line 33 def count_with_reputation(*args) reputation_name, srn, find_scope, = parse_query_args(*args) [:joins] = build_join_statement(table_name, name, srn, [:joins]) [:conditions] = build_condition_statement([:conditions]) [:conditions][0].gsub!(reputation_name.to_s, "COALESCE(rs_reputations.value, 0)") count(find_scope, ) end |
#find_with_normalized_reputation(*args) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/reputation_system/finder_methods.rb', line 41 def find_with_normalized_reputation(*args) reputation_name, srn, find_scope, = parse_query_args(*args) [:select] = build_select_statement(table_name, reputation_name, [:select], srn, true) [:joins] = build_join_statement(table_name, name, srn, [:joins]) [:conditions] = build_condition_statement([:conditions]) find(find_scope, ) end |
#find_with_reputation(*args) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/reputation_system/finder_methods.rb', line 25 def find_with_reputation(*args) reputation_name, srn, find_scope, = parse_query_args(*args) [:select] = build_select_statement(table_name, reputation_name, [:select]) [:joins] = build_join_statement(table_name, name, srn, [:joins]) [:conditions] = build_condition_statement([:conditions]) find(find_scope, ) end |
#find_with_reputation_sql(*args) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/reputation_system/finder_methods.rb', line 49 def find_with_reputation_sql(*args) reputation_name, srn, find_scope, = parse_query_args(*args) [:select] = build_select_statement(table_name, reputation_name, [:select]) [:joins] = build_join_statement(table_name, name, srn, [:joins]) [:conditions] = build_condition_statement([:conditions]) if respond_to?(:construct_finder_sql, true) construct_finder_sql() else construct_finder_arel().to_sql end end |