Class: Recliner::ViewDocument
- Defined in:
- lib/recliner/views/document.rb
Instance Attribute Summary
Attributes inherited from Document
Instance Method Summary collapse
Methods inherited from Document
#==, #delete, #destroy, #initialize, #new_record?, #read_only!, #read_only?, #save, #save!, #update_attributes
Constructor Details
This class inherits a constructor from Recliner::Document
Instance Method Details
#invoke(view, *args) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/recliner/views/document.rb', line 11 def invoke(view, *args) views[view].invoke(database, "#{id}/_view/#{view}", *args) rescue DocumentNotFound # The view disappeared from the database while we were working with the view document. # Reset the revision, save the view document, and try to invoke the view again. self.rev = nil save! and retry end |
#update_views(new_views) ⇒ Object
6 7 8 9 |
# File 'lib/recliner/views/document.rb', line 6 def update_views(new_views) self.views = views.dup.replace(new_views) save! if changed? end |