[updated #16] admin_id renamed to admin_uname.

This commit is contained in:
George Vinogradov 2011-12-11 21:43:42 +04:00
parent b9c0f1e3d9
commit c3f4c8dd87
3 changed files with 5 additions and 5 deletions

View File

@ -52,11 +52,11 @@ class PlatformsController < ApplicationController
def create def create
@platform = Platform.new params[:platform] @platform = Platform.new params[:platform]
@platform.owner = (params[:admin_id]) ? User.find_by_uname(params[:admin_id]) : nil @platform.owner = (params[:admin_uname]) ? User.find_by_uname(params[:admin_uname]) : nil
@platform.owner ||= get_owner @platform.owner ||= get_owner
if @platform.save! if @platform.save!
@platform.make_admin_relation(params[:admin_id]) # @platform.make_admin_relation(@platform.owner.id)
flash[:notice] = I18n.t("flash.platform.saved") flash[:notice] = I18n.t("flash.platform.saved")
redirect_to @platform redirect_to @platform
else else

View File

@ -21,8 +21,8 @@
= f.check_box :released, :class => 'check_box' = f.check_box :released, :class => 'check_box'
.group .group
= label_tag "", t("layout.platforms.admin_id"), :class => :label = label_tag "admin_uname", t("layout.platforms.admin_id"), :class => :label
= autocomplete_field_tag 'admin_id', params[:admin_id], autocomplete_user_uname_platforms_path = autocomplete_field_tag 'admin_uname', params[:admin_uname], autocomplete_user_uname_platforms_path
=# text_field_tag 'admin_id', '', :id => 'admin_id_field' =# text_field_tag 'admin_id', '', :id => 'admin_id_field'
.group.navform.wat-cf .group.navform.wat-cf

View File

@ -70,7 +70,7 @@ describe PlatformsController do
context 'when owner uname present' do context 'when owner uname present' do
it 'should create platform with mentioned owner' do it 'should create platform with mentioned owner' do
post :create, @create_params.merge({:admin_id => @user.uname}) post :create, @create_params.merge({:admin_uname => @user.uname})
Platform.last.owner.id.should eql(@user.id) Platform.last.owner.id.should eql(@user.id)
end end