lib/active_groonga/base.rb in activegroonga-4.0.0 vs lib/active_groonga/base.rb in activegroonga-4.2.0

- old
+ new

@@ -93,12 +93,11 @@ if attributes.is_a?(Array) attributes.collect do |nested_attributes| create(nested_attributes, &block) end else - object = new(attributes) - yield(object) if block_given? + object = new(attributes, &block) object.save object end end @@ -134,11 +133,12 @@ def select(options={}) return all(options) unless block_given? records = table.select do |record| yield(record) end - create_result_set(records, :expression => records.expression) + create_result_set(records, + options.merge(:expression => records.expression)) end def all(options={}) create_result_set(table) end @@ -270,9 +270,10 @@ reload_attributes(record_or_attributes) else reload_attributes self.attributes = (record_or_attributes || {}) end + yield(self) if block_given? end def have_column?(name) table.have_column?(name) end