Skip to content

Instantly share code, notes, and snippets.

View Sporky023's full-sized avatar

Luke Griffiths Sporky023

View GitHub Profile
class Tagging < ActiveRecord::Base
belongs_to :tag
belongs_to :post
validates :tag, :uniqueness => {:scope => :post}
end
$ gem install rails -v=3.1.0.rc5
23 gems installed
$ rails -v
Rails 3.1.0.rc5
$ rails new uniqueness_debugging
$ cd uniqueness_debugging/
$ rails generate model post name:string
$ rails generate model tag name:string
$ rails generate model tagging tag:references post:references
validates :tag_id, :uniqueness => {:scope => :post_id}
validates :tag, :uniqueness => {:scope => :post}
vdiamond: cap deploy
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_finalize_update)
triggering start callbacks for `deploy'
* executing `multistage:ensure'
*** Defaulting to `staging'
* executing `staging'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
if @dn_email.confirmation_letter?
VUtility.logged_in_user_id = session[:user].id
@dn_email.job.update_attributes(:confirmation_letter_event_id => @event.id)
redirect_url = "/jobs/#{@dn_email.job_id};edit"
else
redirect_url = "/leads/#{@dn_email.lead_id};show"
end
# change 1
if @dn_email.confirmation_letter?