class Item < ActiveRecord::Base
belongs_to :user
before_validation :set_user_increment_id, :on => :create
validates :user_increment_id, :presence => true, :uniqueness => {:scope => :user_id}
private
def set_user_increment_id
self.user_increment_id = self.class.where(:user_id => user_id).last.user_increment_id + 1 rescue 1
end
end
match "*path", :to => "errors#not_found"
hashtag = Hashtag.new(:name => workpiece).save!