Skip to content

Instantly share code, notes, and snippets.

View lscott3's full-sized avatar

Larry Scott lscott3

View GitHub Profile
@lscott3
lscott3 / account.rb
Created March 26, 2012 06:21
Builder
class Account < ActiveRecord::Base
belongs_to :package
has_many :users
has_many :clients
has_many :items
has_many :attributes
has_many :notes
accepts_nested_attributes_for :users
accepts_nested_attributes_for :clients
accepts_nested_attributes_for :attributes
@lscott3
lscott3 / new.html.erb
Created December 29, 2011 02:38
Nested Resource Problem
<div id='new-category'>
<h4>Add a new category</h4>
<div id="error-space"></div>
<%= form_for([@account.vanity_url, @new_category]) do |cat| %>
<%= cat.text_field :name %>
<%= cat.submit %>
<% end -%>
<%= link_to "Close", "#", :id => "close" %>
</div>
@lscott3
lscott3 / routes.rb
Created December 20, 2011 03:43
nested resource
scope "/:vanity_url" do
resources :companies, :path => '/clients' do
resources :service_records
end