Adding postal code to users
This commit is contained in:
parent
92c3a6d2be
commit
56450cf319
|
@ -9,7 +9,7 @@ class User < ActiveRecord::Base
|
|||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden, :marketing_source, :payee, :accountant, :exit_reason, :twitter_url, :facebook_url, :github_url, :website_url, :email_visible, :phone_visible #TODO: make admin/instructor/member/etc not accessible
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden, :marketing_source, :payee, :accountant, :exit_reason, :twitter_url, :facebook_url, :github_url, :website_url, :email_visible, :phone_visible, :postal_code #TODO: make admin/instructor/member/etc not accessible
|
||||
|
||||
has_many :cards
|
||||
has_many :user_certifications
|
||||
|
@ -19,6 +19,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
validates_format_of [:twitter_url, :facebook_url, :github_url, :website_url], :with => URI::regexp(%w(http https)), :allow_blank => true
|
||||
|
||||
validates_presence_of :postal_code
|
||||
|
||||
after_create :send_new_user_email
|
||||
|
||||
def absorb_user(user_to_absorb)
|
||||
|
|
|
@ -35,6 +35,11 @@ Thanks again, and happy hacking!</p>
|
|||
<%= f.label :phone_visible, "Show Phone to All Members?" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :postal_code, "Residential Postal Code" %><br />
|
||||
<%= f.text_field :postal_code %> (we'd like to know where you're commuting from!)
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :twitter_url %>
|
||||
<%= f.text_field :twitter_url, :placeholder => "https://twitter.com/heatsynclabs" %><br/>
|
||||
|
@ -71,13 +76,13 @@ Thanks again, and happy hacking!</p>
|
|||
<%= f.text_area :marketing_source %>
|
||||
</div>
|
||||
|
||||
<div><%= f.label :password %><% if params[:action]!='new' %> <em>(Only if you want to change your password)</em><% end %><br />
|
||||
<div><%= f.label :password %><% unless ['new','create'].include?(params[:action]) %> <em>(Only if you want to change your password)</em><% end %><br />
|
||||
<%= f.password_field :password %></div>
|
||||
|
||||
<div><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></div>
|
||||
|
||||
<% if params[:action]!='new' %>
|
||||
<% unless ['new','create'].include?(params[:action]) %>
|
||||
<div><%= f.label :current_password, "Type Your Current Password" %> <em>(For your account's security)</em><br />
|
||||
<%= f.password_field :current_password %></div>
|
||||
<% end %>
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
<%= f.check_box :phone_visible %>
|
||||
<%= f.label :phone_visible, "Show Phone to All Members?" %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :postal_code, "Residential Postal Code" %><br />
|
||||
<%= f.text_field :postal_code %> (we'd like to know where you're commuting from!)
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :twitter_url %>
|
||||
<%= f.text_field :twitter_url, :placeholder => "https://twitter.com/heatsynclabs" %><br/>
|
||||
|
|
5
db/migrate/20140209025344_add_postal_code_to_users.rb
Normal file
5
db/migrate/20140209025344_add_postal_code_to_users.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddPostalCodeToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :postal_code, :string
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130928112252) do
|
||||
ActiveRecord::Schema.define(:version => 20140209025344) do
|
||||
|
||||
create_table "cards", :force => true do |t|
|
||||
t.string "card_number"
|
||||
|
@ -174,6 +174,7 @@ ActiveRecord::Schema.define(:version => 20130928112252) do
|
|||
t.string "website_url"
|
||||
t.boolean "email_visible"
|
||||
t.boolean "phone_visible"
|
||||
t.string "postal_code"
|
||||
end
|
||||
|
||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
||||
|
|
10
test/fixtures/users.yml
vendored
10
test/fixtures/users.yml
vendored
|
@ -2,12 +2,8 @@
|
|||
|
||||
one:
|
||||
name: MyString
|
||||
card_id: 1
|
||||
card_number: MyString
|
||||
card_permissions: 1
|
||||
postal_code: 12345
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
card_id: 1
|
||||
card_number: MyString
|
||||
card_permissions: 1
|
||||
name: MyString2
|
||||
postal_code: 23456
|
||||
|
|
Loading…
Reference in New Issue
Block a user