Class: FmStore::FmReader
- Inherits:
-
Object
- Object
- FmStore::FmReader
- Includes:
- Paging
- Defined in:
- lib/fm_store/criteria.rb
Instance Attribute Summary collapse
-
#criteria ⇒ Object
readonly
Returns the value of attribute criteria.
Instance Method Summary collapse
- #count ⇒ Object
-
#execute(paginating = false) ⇒ Object
This is the method to really get down and grab the records The criteria find_query flag will be set to true if it is a -findquery.
-
#initialize(criteria) ⇒ FmReader
constructor
A new instance of FmReader.
Methods included from Paging
Constructor Details
#initialize(criteria) ⇒ FmReader
Returns a new instance of FmReader.
15 16 17 |
# File 'lib/fm_store/criteria.rb', line 15 def initialize(criteria) @criteria = criteria end |
Instance Attribute Details
#criteria ⇒ Object (readonly)
Returns the value of attribute criteria.
11 12 13 |
# File 'lib/fm_store/criteria.rb', line 11 def criteria @criteria end |
Instance Method Details
#count ⇒ Object
19 20 21 |
# File 'lib/fm_store/criteria.rb', line 19 def count @count ||= 0 end |
#execute(paginating = false) ⇒ Object
This is the method to really get down and grab the records The criteria find_query flag will be set to true if it is a -findquery
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fm_store/criteria.rb', line 25 def execute(paginating = false) ActiveSupport::Notifications.instrument(:fm_store_execute, :model_name => klass.to_s, :params => params, :options => ) do conn = Connection.establish_connection(klass) if find_query # We will be using the -findquery command rs = conn.send(:get_records, "-findquery", params, ) else rs = conn.find(params, ) end @count = rs.foundset_count if paginating FmStore::Builders::Collection.build(rs, klass) end end |