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
431 432 433 |
# File 'lib/engine2/action.rb', line 431 def find_record handler, id get_query.load assets[:model].primary_keys_hash_qualified(split_keys(id)) end |
#get_query ⇒ Object
move to query ?
423 424 425 426 427 428 429 |
# File 'lib/engine2/action.rb', line 423 def get_query # move to query ? if dynamic? @query || @static.get_query else @query end end |
#post_run ⇒ Object
418 419 420 421 |
# File 'lib/engine2/action.rb', line 418 def post_run query select(*assets[:model].columns) unless @query super end |
#query(q, &blk) ⇒ Object
414 415 416 |
# File 'lib/engine2/action.rb', line 414 def query q, &blk @query = blk ? q.naked.with_row_proc(blk) : q.naked end |
#select(*args, use_pk: true, &blk) ⇒ Object
435 436 437 438 439 |
# File 'lib/engine2/action.rb', line 435 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 |