Class: Blogo::UpdatePostService
- Inherits:
-
BasePostService
- Object
- BasePostService
- Blogo::UpdatePostService
- Defined in:
- app/services/blogo/update_post_service.rb
Constant Summary
Constants inherited from BasePostService
Instance Attribute Summary collapse
-
#post ⇒ Object
readonly
Returns the value of attribute post.
Instance Method Summary collapse
-
#initialize(post, params) ⇒ UpdatePostService
constructor
A new instance of UpdatePostService.
- #update! ⇒ Object
Constructor Details
#initialize(post, params) ⇒ UpdatePostService
Returns a new instance of UpdatePostService.
5 6 7 8 9 |
# File 'app/services/blogo/update_post_service.rb', line 5 def initialize(post, params) @post = post @tags_string = params.delete(:tags_string) @post_attrs = params end |
Instance Attribute Details
#post ⇒ Object (readonly)
Returns the value of attribute post.
3 4 5 |
# File 'app/services/blogo/update_post_service.rb', line 3 def post @post end |
Instance Method Details
#update! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/blogo/update_post_service.rb', line 11 def update! assign_attributes return false unless @post.valid? @post.transaction do (@tags_string) @post.save! end true end |