Quickfix private_users password generation. Refs #2162

This commit is contained in:
Pavel Chipiga 2011-11-02 02:45:19 +02:00
parent 7e523913c5
commit 6f7f42b4a9
2 changed files with 3 additions and 3 deletions

View File

@ -12,8 +12,8 @@ class PrivateUser < ActiveRecord::Base
end
class << self
def can_generate_more?(user_id)
!PrivateUser.exists?(:user_id => user_id)
def can_generate_more?(user_id, platform_id)
!PrivateUser.exists?(:user_id => user_id, :platform_id => platform_id)
end
def generate_pair(platform_id, user_id)

View File

@ -30,7 +30,7 @@
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.private_users.list"), platform_private_users_path(@platform)
%li= link_to t("layout.private_users.new"), platform_private_users_path(@platform), :method => :post if PrivateUser.can_generate_more?(current_user.id)
%li= link_to t("layout.private_users.new"), platform_private_users_path(@platform), :method => :post if PrivateUser.can_generate_more?(current_user.id, @platform.id)
.content
%h2.title
= t("layout.private_users.list_header")