From c3f4c8dd8797ced759088b0051a90c9bb35aaced Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Sun, 11 Dec 2011 21:43:42 +0400 Subject: [PATCH] [updated #16] admin_id renamed to admin_uname. --- app/controllers/platforms_controller.rb | 4 ++-- app/views/platforms/_form.html.haml | 4 ++-- spec/controllers/platforms_controller_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb index b485c6cfe..dc9fe0bbb 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms_controller.rb @@ -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 diff --git a/app/views/platforms/_form.html.haml b/app/views/platforms/_form.html.haml index d1684ee25..2665b658f 100644 --- a/app/views/platforms/_form.html.haml +++ b/app/views/platforms/_form.html.haml @@ -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 diff --git a/spec/controllers/platforms_controller_spec.rb b/spec/controllers/platforms_controller_spec.rb index 8b4b9f06e..c0ac1fb15 100644 --- a/spec/controllers/platforms_controller_spec.rb +++ b/spec/controllers/platforms_controller_spec.rb @@ -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