Skip to content

Commit

Permalink
add uniq to post category`s habtm with posts
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus committed Mar 26, 2012
1 parent 0270797 commit bd80e40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/spree/post_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Spree::PostCategory < ActiveRecord::Base
validates :name, :presence => true
validates :permalink, :presence => true, :uniqueness => true, :if => proc{ |record| !record.name.blank? }

has_and_belongs_to_many :posts, :join_table => 'spree_post_categories_posts'
has_and_belongs_to_many :posts, :join_table => 'spree_post_categories_posts', :uniq => true

before_validation :create_permalink

Expand Down

0 comments on commit bd80e40

Please sign in to comment.