Class: Blogo::PreviewPostService

Inherits:
BasePostService show all
Defined in:
app/services/blogo/preview_post_service.rb

Overview

Creates new model of posts applying post params on it so it can be previewed.

Constant Summary

Constants inherited from BasePostService

BasePostService::JUMP_BREAK

Instance Method Summary collapse

Constructor Details

#initialize(user, params) ⇒ PreviewPostService

Returns a new instance of PreviewPostService.

Parameters:



6
7
8
9
# File 'app/services/blogo/preview_post_service.rb', line 6

def initialize(user, params)
  @post        = user.posts.build
  @post_attrs  = params
end

Instance Method Details

#previewBlogo::Post

Assign post attributes and return a post.

Returns:



14
15
16
17
# File 'app/services/blogo/preview_post_service.rb', line 14

def preview
  assign_attributes
  @post
end