[refs #442] Fix auto_publish validate and default set

This commit is contained in:
konstantin.grabar 2012-05-29 17:44:30 +04:00
parent a51737d58c
commit 8eaec85aff
5 changed files with 13 additions and 7 deletions

View File

@ -12,7 +12,7 @@ class Platforms::PlatformsController < Platforms::BaseController
:user => current_user, :user => current_user,
:repositories => params[:repositories], :repositories => params[:repositories],
:arches => params[:arches], :arches => params[:arches],
:auto_publish => params[:auto_publish] :auto_publish => params[:auto_publish] || false
) )
if mass_build.save if mass_build.save
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success")) redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))

View File

@ -7,7 +7,8 @@ class MassBuild < ActiveRecord::Base
attr_accessor :repositories, :arches attr_accessor :repositories, :arches
validates :platform_id, :auto_publish, :arch_names, :name, :user_id, :repositories, :presence => true validates :platform_id, :arch_names, :name, :user_id, :repositories, :presence => true
validates_inclusion_of :auto_publish, :in => [true, false]
after_create :build_all after_create :build_all

View File

@ -19,7 +19,7 @@
.both .both
%h3= t("activerecord.attributes.build_list.preferences") %h3= t("activerecord.attributes.build_list.preferences")
.both.bottom_20 .both.bottom_20
= check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : true, :id => 'auto_publish' = check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : false, :id => 'auto_publish'
= label_tag :auto_publish = label_tag :auto_publish
%br %br

View File

@ -0,0 +1,5 @@
class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration
def change
change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120523113925) do ActiveRecord::Schema.define(:version => 20120529130537) do
create_table "activity_feeds", :force => true do |t| create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false t.integer "user_id", :null => false
@ -215,11 +215,11 @@ ActiveRecord::Schema.define(:version => 20120523113925) do
create_table "mass_builds", :force => true do |t| create_table "mass_builds", :force => true do |t|
t.integer "platform_id" t.integer "platform_id"
t.string "name" t.string "name"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "arch_names" t.string "arch_names"
t.integer "user_id" t.integer "user_id"
t.boolean "auto_publish" t.boolean "auto_publish", :default => false, :null => false
end end
create_table "platforms", :force => true do |t| create_table "platforms", :force => true do |t|