Created
April 2, 2013 16:49
-
-
Save coderforhire/5293867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form"}) do |f| %> | |
<% @user.domains.build %> | |
<%= devise_error_messages! %> | |
<%= f.email_field :email, :autofocus => true, :placeholder => "Email" %></br> | |
<%= f.password_field :password, :placeholder => "Password" %> | |
<%= f.password_field :password_confirmation, :placeholder => "Password again, please." %> | |
<%= f.fields_for :domains do |domain_form| %> | |
<%= domain_form.text_field :domain_name, :placeholder => "Domain Name" %> | |
<%= domain_form.text_field :domain_price, :placeholder => "Price (USD)" %> | |
<% end %> | |
<div><%= f.submit "Sign up", :class => " span3 btn btn-block btn-large" %></div> | |
<% end %> | |
~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Domain < ActiveRecord::Base | |
require "addressable/uri" | |
@@heroku = Heroku::API.new(:username => USER, :password => PASS) | |
belongs_to :user | |
attr_accessible :name, :price, :user_id | |
def add_user_domain(domain) | |
www_domain = 'www.' + domain | |
@@heroku.post_domain('namesushi', domain) | |
@@heroku.post_domain('namesushi', www_domain) | |
end | |
end | |
~ | |
~ | |
~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= render 'devise/registrations/form' %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_many :domains | |
accepts_nested_attributes_for :domains | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :email, :password, :password_confirmation, :remember_me, :domains_attributes | |
end | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment