Class: Pulitzer::PostsController::Create

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
app/interactions/pulitzer/posts_controller/create.rb

Instance Method Summary collapse

Methods included from Validations

#validate_title

Constructor Details

#initialize(params) ⇒ Create

Returns a new instance of Create.



4
5
6
# File 'app/interactions/pulitzer/posts_controller/create.rb', line 4

def initialize(params)
  @params = params
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
# File 'app/interactions/pulitzer/posts_controller/create.rb', line 8

def call
  @post = Pulitzer::Post.new(@params)
  validate_title or return @post
  @post.save
  @post.create_preview_version
  @post
end