Permalink
Browse files

Removed master user flag.

  • Loading branch information...
1 parent 5b53eff commit 12a76f10ad1ff313b6e09bdc661236ea77a6712d @amartinfraguas amartinfraguas committed Feb 3, 2011
@@ -11,36 +11,6 @@ class UserMap < ActiveRecord::Base
um.hr_user_id = user_hr ? user_hr.id : nil
end
- before_save do |um|
- # keep only 1 master user per account
- if um.master_user
- # careful with these methods, no validations or callbacks are used
- if um.id
- UserMap.update_all(["master_user = ?", false], ["account_id = ? AND id != ? AND master_user = ?", um.account_id, um.id, true])
- else
- UserMap.update_all(["master_user = ?", false], ["account_id = ? AND master_user = ?", um.account_id, true])
- end
- else
- current_other_masters = (UserMap.find_all_by_account_id_and_master_user(um.account_id,true)).reject{|mu| mu.id == um.id}
- if current_other_masters.blank?
- um.master_user = true
- end
- end
- end
-
- after_destroy do |um|
- # if the master user is destroyed, choose a new master user
- if um.master_user
- new_master = UserMap.find_by_account_id um.account_id
- if new_master
- unless new_master.master_user
- new_master.master_user = true
- new_master.save
- end
- end
- end
- end
-
def hr_parties_feed(is_new_user)
timestamp = is_new_user ? ApiOperations::Common::INITIAL_DATETIME : self.account.hr_parties_last_synchronized_at
@@ -65,13 +65,6 @@
ajaxDeleteUserMapForm()
})
- // manage master user radio buttons
- $('input.master_radio').live('click', function() {
- $('input.master_radio').removeAttr('checked');
- $(this).attr('checked','checked');
- $(this).parent().submit();
- });
-
$('#wait').hide();
$('#error_container').hide();
$('#notice_container').hide();
@@ -22,9 +22,6 @@
<span class="ringioUser">
<%= select :user_map, :rg_user_id, @mails_for_select, :selected => user_map.rg_user_id %>
</span>
- <span class="radioCell">
- <%= f.radio_button :master_user, true, :class => 'master_radio' %>
- </span>
<span class="actions">
<%= f.submit t('test_and_update') %>
</span>
@@ -18,9 +18,6 @@
<span class="ringioUser">
<%= select :user_map, :rg_user_id, @mails_for_select %>
</span>
- <span class="radioCell">
- <%= f.radio_button :master_user, true %>
- </span>
<span class="actions">
<%= f.submit t('create') %>
</span>
@@ -1,6 +1,5 @@
<div class="thead">
<span class="highrise"><%= t('user_map.hr_user_token') %></span>
<span class="ringioUser"><%= t('user_map.rg_user') %></span>
- <span class="radioCell"><%= t('user_map.master_user') %></span>
<span class="actions"><%= t('actions') %></span>
</div>
@@ -0,0 +1,9 @@
+class RemoveMasterUserFlag < ActiveRecord::Migration
+ def self.up
+ remove_column :user_maps, :master_user
+ end
+
+ def self.down
+ add_column :user_maps, :master_user, :boolean, :default => false
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20101213164155) do
+ActiveRecord::Schema.define(:version => 20110203120634) do
create_table "accounts", :force => true do |t|
t.integer "rg_account_id"
@@ -58,7 +58,6 @@
t.integer "hr_user_id"
t.integer "rg_user_id"
t.string "hr_user_token"
- t.boolean "master_user", :default => false
t.boolean "not_synchronized_yet", :default => true
t.datetime "created_at"
t.datetime "updated_at"

0 comments on commit 12a76f1

Please sign in to comment.