Skip to content

Instantly share code, notes, and snippets.

@JonasNielsen
Created March 23, 2010 17:18
Show Gist options
  • Save JonasNielsen/341419 to your computer and use it in GitHub Desktop.
Save JonasNielsen/341419 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
belongs_to :userable, :polymorphic => true
end
class Designer < ActiveRecord::Base
has_one :user_login, :as => :userable
accepts_nested_attributes_for :user_login
end
class DesignersController < ApplicationController
def new
@designer = Designer.new
#@designer.user_login.build
respond_to do |format|
format.html
end
end
end
# View uses f.fields_for :user_login do |login|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment