Skip to content

Instantly share code, notes, and snippets.

@jqr
Created June 10, 2009 18:32
Show Gist options
  • Save jqr/127405 to your computer and use it in GitHub Desktop.
Save jqr/127405 to your computer and use it in GitHub Desktop.
class Account < ActiveRecord::Base
has_many :users
belongs_to :first_user, :class_name => 'User'
accepts_nested_attributes_for :first_user
end
class AccountsController < ApplicationController
def new
@account = Account.new(:first_user => User.new)
# ...
end
# ...
end
<% semantic_form_for(@account) do |f| %>
<% f.inputs :name => 'Account' do %>
<%= f.input :name %>
<% end %>
<%= f.inputs :email, :password, :password_confirmation, :for => :first_user, :name => 'User' %>
<%= f.buttons %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment