Module: Engine2::ActionQuerySupport
- Included in:
- DecodeAction, FormAction, ListAction, ViewAction
- Defined in:
- lib/engine2/action.rb
Instance Method Summary collapse
- #find_record(handler, id) ⇒ Object
-
#get_query ⇒ Object
move to query ?.
- #post_run ⇒ Object
- #query(q, &blk) ⇒ Object
- #select(*args, use_pk: true, &blk) ⇒ Object
Instance Method Details
#find_record(handler, id) ⇒ Object
430 431 432 |
# File 'lib/engine2/action.rb', line 430 def find_record handler, id get_query.load assets[:model].primary_keys_hash_qualified(split_keys(id)) end |
#get_query ⇒ Object
move to query ?
422 423 424 425 426 427 428 |
# File 'lib/engine2/action.rb', line 422 def get_query # move to query ? if dynamic? @query || @static.get_query else @query end end |
#post_run ⇒ Object
417 418 419 420 |
# File 'lib/engine2/action.rb', line 417 def post_run query select(*assets[:model].columns) unless @query super end |
#query(q, &blk) ⇒ Object
413 414 415 |
# File 'lib/engine2/action.rb', line 413 def query q, &blk @query = blk ? q.naked.with_row_proc(blk) : q.naked end |
#select(*args, use_pk: true, &blk) ⇒ Object
434 435 436 437 438 |
# File 'lib/engine2/action.rb', line 434 def select *args, use_pk: true, &blk ds = assets[:model].select(*args, &blk) ds = ds.ensure_primary_key if use_pk ds.setup_query(@meta[:field_list] = []) end |