Sha256: a9e353eda51814bc44ab0ec4992dc4bcdad578aaf2f92132348bd8a6b6ed492b

Contents?: true

Size: 319 Bytes

Versions: 19

Compression:

Stored size: 319 Bytes

Contents

module Pulitzer::PostsController::Validations
  def validate_title
    if Pulitzer::Post.where(title: @post.title).to_a.any?{|post|
      (post.post_type_version_id == @post.post_type_version_id)}
      @post.errors.add(:title, 'Another post already has this title')
      return false
    end
    return true
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pulitzer-0.15.31 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.30 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.29 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.28 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.27 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.26 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.25 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.24 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.23 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.22 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.21 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.20 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.19 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.18 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.17 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.16 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.15 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.14 app/interactions/pulitzer/posts_controller/validations.rb
pulitzer-0.15.13 app/interactions/pulitzer/posts_controller/validations.rb