Commit a246c071

luu stiles <luuduong@gmail.com>
2012-07-30 06:26:38
update user model to require city and moved city field up on registration signup screen
1 parent dbc270f
Changed files (2)
app
models
views
devise
registrations
app/models/user.rb
@@ -11,6 +11,7 @@ end
 class User < ActiveRecord::Base
   validates :name,  :presence => true
   validates :website, :format => URI::regexp(%w(http https)), :allow_blank => true
+  validates :city, :presence => true
   #validates_with UrlValidation
   devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
   attr_accessible :name, :email, :website, :twitter, :facebook, :city, :latitude, :longitude, :password, :password_confirmation, :current_password, :remember_me, :interest_ids
app/views/devise/registrations/new.html.erb
@@ -73,6 +73,12 @@
                   <%= f.text_field :name, :placeholder => 'Full Name' %>
                 </div>
               </div>
+              <div class="control-group">
+                <%= f.label :city, 'City', :class => "control-label" %>
+                <div class="controls">
+                  <%= f.text_field :city, :placeholder => 'City' %>
+                </div>
+              </div>
               <div class="control-group">
                 <%= f.label :email, 'Email', :class => "control-label" %>
                 <div class="controls">
@@ -91,12 +97,6 @@
                   <%= f.password_field :password_confirmation, :placeholder => 'Password Confirmation' %>
                 </div>
               </div>
-              <div class="control-group">
-                <%= f.label :city, 'City', :class => "control-label" %>
-                <div class="controls">
-                  <%= f.text_field :city, :placeholder => 'City' %>
-                </div>
-              </div>
               <div class="control-group">
                 <label for="accepted" class="control-label"></label>
                 <div class="controls">