Skip to content

Instantly share code, notes, and snippets.

@subject_all = []
@subjects.each do |subject|
@subject_all << [subject.id, subject.batch.name]
end
# Or with a hash:
#
# @subject_all = {}
#
resources :users do
# /users/:id/confirm_email(.:format)
# confirm_mail_user_path
get :confirm_email, :on => :member
end
@contact = Contact.find params[:id]
@contact.attributes = params[:contact]
if params[:is_supplier] == '1'
@contact.type = 'supplier'
elsif params[:is_supplier] == '0'
@contact.type = 'customer'
end
if @contact.save
# provides a slick way to add classes inside haml attribute collections
#
# examples:
# %div{add_class("current")}
# #=> adds the "current" class to the div
#
# %div{add_class("current", :if => current?)}
# #=> adds the "current" class to the div if current? method
#
# %div{add_class("highlight", :unless => logged_in?)}