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