Sha256: d49c00fbd1a8cd7d7442adb5610b631c10cc9ce2b779a14f54f9edf048328794
Contents?: true
Size: 1.3 KB
Versions: 7
Compression:
Stored size: 1.3 KB
Contents
module Nyanko module Unit class Extender module ActiveRecordClassMethods delegate( :apply_modules, :arel, :array_of_strings?, :build_arel, :build_joins, :build_select, :build_where, :create_with, :custom_join_sql, :eager_load, :extending, :from, :group, :having, :includes, :joins, :limit, :lock, :offset, :order, :preload, :readonly, :reorder, :reverse_order, :reverse_sql_order, :scope, :select, :where, :to => :@mod ) %w[belongs_to has_many has_one].each do |method_name| class_eval <<-EOS def #{method_name}(*args, &block) name = @prefix + args.shift.to_s options = args.extract_options! options = options.reverse_merge(:class_name => @mod.to_s) args << options @mod.#{method_name}(name.to_sym, *args, &block) end EOS end def scope(*args, &block) name = @prefix + args.shift.to_s @mod.scope(name, *args) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems