[updated #16] admin_id renamed to admin_uname.
This commit is contained in:
parent
b9c0f1e3d9
commit
c3f4c8dd87
|
@ -52,11 +52,11 @@ class PlatformsController < ApplicationController
|
|||
|
||||
def create
|
||||
@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
|
||||
|
||||
if @platform.save!
|
||||
@platform.make_admin_relation(params[:admin_id])
|
||||
# @platform.make_admin_relation(@platform.owner.id)
|
||||
flash[:notice] = I18n.t("flash.platform.saved")
|
||||
redirect_to @platform
|
||||
else
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
= f.check_box :released, :class => 'check_box'
|
||||
|
||||
.group
|
||||
= label_tag "", t("layout.platforms.admin_id"), :class => :label
|
||||
= autocomplete_field_tag 'admin_id', params[:admin_id], autocomplete_user_uname_platforms_path
|
||||
= label_tag "admin_uname", t("layout.platforms.admin_id"), :class => :label
|
||||
= autocomplete_field_tag 'admin_uname', params[:admin_uname], autocomplete_user_uname_platforms_path
|
||||
=# text_field_tag 'admin_id', '', :id => 'admin_id_field'
|
||||
|
||||
.group.navform.wat-cf
|
||||
|
|
|
@ -70,7 +70,7 @@ describe PlatformsController do
|
|||
context 'when owner uname present' 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)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue