Skip to content

Instantly share code, notes, and snippets.

@Sporky023
Created December 1, 2009 18:43
Show Gist options
  • Save Sporky023/246520 to your computer and use it in GitHub Desktop.
Save Sporky023/246520 to your computer and use it in GitHub Desktop.
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?
@dn_email.job.logged_in_user_id = session[:user].id # DRY violation (for attr_accessor :logged_in_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 2
if @dn_email.confirmation_letter?
@dn_email.job.update_by_form({:confirmation_letter_event_id => @event.id}, session[:user].id) # no longer using update_attributes
redirect_url = "/jobs/#{@dn_email.job_id};edit"
else
redirect_url = "/leads/#{@dn_email.lead_id};show"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment