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
13 14 15 16 |
# File 'lib/gollum_rails/persistance.rb', line 13 def create(data) page = Page.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
26 27 28 29 |
# File 'lib/gollum_rails/persistance.rb', line 26 def create!(data) page = Page.new(data) page.save! end |