Skip to content

Instantly share code, notes, and snippets.

View waynerobinson's full-sized avatar

Wayne Robinson waynerobinson

View GitHub Profile
# _job
<div>
<%= fields_for :job do | f |
<%= render :partial => 'waypoints/waypoint', :locals => {:job_form => f} %>
</div>
--------------------------------
# _waypoint
@waynerobinson
waynerobinson / gist:904986
Created April 6, 2011 01:48
Address Object
class Address < ActiveRecord::Base
ADDRESS_TYPES = %w(Office Postal Shipping)
default_scope order('created_at DESC')
scope :active, where(active: true)
validates_inclusion_of :address_type, in: ADDRESS_TYPES, message: "must be one of #{ADDRESS_TYPES.to_sentence(last_word_connector: ' or ')}"
belongs_to :source, polymorphic: true