Module: Utusemi::Core::ActiveRecord::Base
- Included in:
- QueryMethods, Querying
- Defined in:
- lib/utusemi/core.rb
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ Object
用途 utusemiメソッドを利用後にレコードを作成した場合は Utusemi::Core#utusemiを個別呼び出さなくても済むようになる.
Instance Method Details
#initialize(*args, &block) ⇒ Object
用途
utusemi
使用例
product = Product.utusemi(:product).new(name: 'test')
product.name
#=> 'test' (= products.title)
255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/utusemi/core.rb', line 255 def initialize(*args, &block) case Rails::VERSION::MAJOR when 4 current_scope = self.class.current_scope when 3 current_scope = self.class.scoped end utusemi_values = current_scope.try(:utusemi_values) || {} utusemi_values = self.class.utusemi_values unless utusemi_values[:flag] utusemi!(utusemi_values[:type], utusemi_values[:options]) if utusemi_values[:flag] super end |