America's Next Top Engineer

F29327647a9cff5c69618bae420792ea?s=47 Aaron Patterson
June 07, 2013
1.8k

America's Next Top Engineer

Presentation popularity at RedDot RubyConf

F29327647a9cff5c69618bae420792ea?s=128

Aaron Patterson

June 07, 2013
Tweet

Transcript

  1. 3.
  2. 12.
  3. 13.
  4. 14.
  5. 16.
  6. 17.
  7. 18.
  8. 21.

    protected def method_missing(method, *args, &block) if Array.method_defined?(method) to_a.send(method, *args, &block)

    elsif @klass.scopes[method] merge(@klass.send(method, *args, &block)) elsif @klass.respond_to?(method) scoping { @klass.send(method, *args, &block) } elsif arel.respond_to?(method) arel.send(method, *args, &block) elsif match = DynamicFinderMatch.match(method) attributes = match.attribute_names super unless @klass.send(:all_attributes_exists?, attributes) if match.finder? find_by_attributes(match, attributes, *args) elsif match.instantiator? find_or_instantiator_by_attributes(match, attributes, *args, &block) end else super end end private def references_eager_loaded_tables? # always convert table names to downcase as in Oracle quoted table names are in uppercase joined_tables = (tables_in_string(arel.joins(arel)) + [table.name, table.table_alias]).compact.map{ |t| t.downcase }.uniq (tables_in_string(to_sql) - joined_tables).any? end
  9. 22.