<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/20090726200034_add_state_id_index_to_campus.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -21,3 +21,4 @@ nbproject/
 public/profile_pictures
 *~
 .project
+config/initializers/cmt_config.rb
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -365,6 +365,10 @@ class ApplicationController &lt; ActionController::Base
       request.format = :facebook if iphone_request?
     end
     
+    def default_country
+      @default_country ||= (Country.find(:first, :conditions =&gt; { _(:country, :country) =&gt; Cmt::CONFIG[:default_country] }) || Country.new)
+    end
+    
 private
   # Ensures that the _person_ is involved in the 'No Ministry' ministry
   # BUG 1857</diff>
      <filename>app/controllers/application_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -344,8 +344,8 @@ class PeopleController &lt; ApplicationController
 
     current_address_states = get_states @person.current_address.try(:state).try(:country_id)
     permanent_address_states = get_states @person.permanent_address.try(:state).try(:country_id)
-    current_address_country_id = @person.current_address.try(:state).try(:country_id)
-    permanent_address_country_id = @person.permanent_address.try(:state).try(:country_id)
+    current_address_country_id = @person.current_address.try(:state).try(:country_id) || default_country.id
+    permanent_address_country_id = @person.permanent_address.try(:state).try(:country_id) || default_country.id
     
     get_people_responsible_for
     get_possible_responsible_people
@@ -702,7 +702,7 @@ class PeopleController &lt; ApplicationController
       @primary_campus_involvement = @person.primary_campus_involvement || CampusInvolvement.new
       # If the Country is set in config, don't filter by states but get campuses from the country
       if Cmt::CONFIG[:campus_scope_country] &amp;&amp; 
-        (c = Country.find :first, :conditions =&gt; { _(:country, :country) =&gt; Cmt::CONFIG[:campus_scope_country] })
+        (c = Country.find(:first, :conditions =&gt; { _(:country, :country) =&gt; Cmt::CONFIG[:campus_scope_country] }))
         @no_campus_scope = true
         @campus_country = c
         @campuses = @campus_country.states.collect{|s| s.campuses}.flatten
@@ -753,13 +753,15 @@ class PeopleController &lt; ApplicationController
       @sql += ' ORDER BY ' + @order
     end
   
-    def get_states
-      country = Country.find params[:primary_campus_country_id]
-      @campus_states = country.try(:states) || []
-    end
-
-    def get_states(country_id)
-      State.find_all_by_country_id(country_id)
+    def get_states(country_id = nil)
+      if country_id
+        states = State.find_all_by_country_id(country_id)
+      else
+        country = Country.find(params[:primary_campus_country_id]) if params[:primary_campus_country_id]
+        states = @campus_states = country.try(:states)
+      end
+      states = default_country.states if states.blank?
+      states || []
     end
 
     def set_use_address2</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,14 +13,12 @@
   &lt;/div&gt;
 &lt;/div&gt; --&gt;
 
-&lt;%- help_block do -%&gt; 
   &lt;h3&gt;Customization&lt;/h3&gt;  
 
   &lt;p&gt;You can edit a number of things from this page. 
   Click on each of the category headings to open that category of customization.
   You can view help on each section.
   &lt;/p&gt;
-&lt;%- end -%&gt;
 
 &lt;div id=&quot;customizebody&quot; class=&quot;accordion&quot;&gt;
 </diff>
      <filename>app/views/customize/_customize.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,5 @@
 &lt;td id =&quot;current_address_state_dropdown&quot;&gt;
 	&lt;%=
-		collection_select :current_address,
-			:state_id,
-			states,
-			:id,
-			:name,
-			{ :prompt =&gt; true }
+		collection_select(:current_address,	:state_id, states, :id, :name, { :prompt =&gt; true })
 	%&gt;
 &lt;/td&gt;
\ No newline at end of file</diff>
      <filename>app/views/people/_current_address_state_dropdown.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -27,7 +27,7 @@
           &lt;%= render :partial =&gt; 'current_address',
             :locals =&gt; {
 				:dorms =&gt; @dorms,
-				:states =&gt; @current_address_states,
+				:states =&gt; current_address_states,
 				:current_address_country_id =&gt; current_address_country_id,
 				:countries =&gt; countries }
         %&gt;</diff>
      <filename>app/views/people/_edit.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -71,6 +71,10 @@ Rails::Initializer.run do |config|
   # All files from config/locales/*.rb,yml are added automatically.
   # config.i18n.load_path &lt;&lt; Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
   # config.i18n.default_locale = :de
+  
+  if File.exists?(File.join(RAILS_ROOT, 'config', 'initializers', 'cmt_config.example')) &amp;&amp; !File.exists?(File.join(RAILS_ROOT, 'config', 'initializers', 'cmt_config.rb'))
+    FileUtils.cp(File.join(RAILS_ROOT, 'config', 'initializers', 'cmt_config.example'), File.join(RAILS_ROOT, 'config', 'initializers', 'cmt_config.rb'))
+  end
 end
 
 </diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,8 @@ module Cmt
     # campuses from this country are displayed
     # Set to nil(:campus_scope_country =&gt; nil) to disable.
     :campus_scope_country =&gt; 'Canada',
+    
+    :default_country =&gt; 'Canada',
 
     # Disable second address line
     :disable_address2 =&gt; false,</diff>
      <filename>config/initializers/cmt_config.example</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 20090613034002) do
+ActiveRecord::Schema.define(:version =&gt; 20090726200034) do
 
   create_table &quot;addresses&quot;, :force =&gt; true do |t|
     t.integer &quot;person_id&quot;
@@ -73,6 +73,8 @@ ActiveRecord::Schema.define(:version =&gt; 20090613034002) do
   end
 
   add_index &quot;campuses&quot;, [&quot;county&quot;], :name =&gt; &quot;index_campuses_on_county&quot;
+  add_index &quot;campuses&quot;, [&quot;name&quot;], :name =&gt; &quot;index_campuses_on_name&quot;
+  add_index &quot;campuses&quot;, [&quot;state_id&quot;], :name =&gt; &quot;index_campuses_on_state_id&quot;
 
   create_table &quot;columns&quot;, :force =&gt; true do |t|
     t.string   &quot;title&quot;</diff>
      <filename>db/schema.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>96c0759b2e91725e4a3277a80c7b8ffb8c1ac1c3</id>
    </parent>
  </parents>
  <author>
    <name>Josh Starcher</name>
    <email>josh@josh-starchers-mac-pro.local</email>
  </author>
  <url>http://github.com/twinge/ministry-tracker/commit/02bc53f8945399d0fe0b1c341ccf040d4921b606</url>
  <id>02bc53f8945399d0fe0b1c341ccf040d4921b606</id>
  <committed-date>2009-07-26T13:45:59-07:00</committed-date>
  <authored-date>2009-07-26T13:45:59-07:00</authored-date>
  <message>fix editing a profile</message>
  <tree>3339c575ffd52265d3fe75c187bbf7cb27028739</tree>
  <committer>
    <name>Josh Starcher</name>
    <email>josh@josh-starchers-mac-pro.local</email>
  </committer>
</commit>
