Module: GollumRails::Persistance::ClassMethods
- Defined in:
- lib/gollum_rails/persistance.rb
Instance Method Summary collapse
-
#create(data) ⇒ Object
first creates an instance of itself and executes the save function.
-
#create!(data) ⇒ Object
calls ‘create` on current class.
Instance Method Details
#create(data) ⇒ Object
first creates an instance of itself and executes the save function.
data - Hash containing the page data
Returns an instance of Gollum::Page or false
15 16 17 18 |
# File 'lib/gollum_rails/persistance.rb', line 15 def create(data) page = self.new(data) page.save end |
#create!(data) ⇒ Object
calls ‘create` on current class. If returned value is nil an exception will be thrown
data - Hash of Data containing all necessary stuff TODO write this stuff
Returns an instance of Gollum::Page
27 28 29 30 |
# File 'lib/gollum_rails/persistance.rb', line 27 def create!(data) page = self.new(data) page.save! end |