Module: Immunio::StatementCacheHooks::ClassMethods
- Defined in:
- lib/immunio/plugins/active_record_relation.rb
Instance Method Summary collapse
-
#create_with_immunio(*args, &block) ⇒ Object
When a statement is cached, store the final relation used to generate the statement in a special immunio instance variable.
Instance Method Details
#create_with_immunio(*args, &block) ⇒ Object
When a statement is cached, store the final relation used to generate the statement in a special immunio instance variable.
254 255 256 257 258 259 260 261 262 263 |
# File 'lib/immunio/plugins/active_record_relation.rb', line 254 def create_with_immunio(*args, &block) # The relation is returned by the block passed into the create method. # This is more fragile than most of our method wrappings as we depend on # *how* the method works, but there's no way around it. relation = block.call ActiveRecord::StatementCache::Params.new ret = create_without_immunio(*args) { relation } ret.instance_variable_set :@__immunio_relation, relation ret end |