diff --git a/app/controllers/platforms/platforms_controller.rb b/app/controllers/platforms/platforms_controller.rb index e2073276f..4f8192456 100644 --- a/app/controllers/platforms/platforms_controller.rb +++ b/app/controllers/platforms/platforms_controller.rb @@ -12,7 +12,7 @@ class Platforms::PlatformsController < Platforms::BaseController :user => current_user, :repositories => params[:repositories], :arches => params[:arches], - :auto_publish => params[:auto_publish] + :auto_publish => params[:auto_publish] || false ) if mass_build.save redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success")) diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index d82ff7d0c..01bf362fb 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -7,7 +7,8 @@ class MassBuild < ActiveRecord::Base 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 diff --git a/app/views/platforms/platforms/build_all.html.haml b/app/views/platforms/platforms/build_all.html.haml index c3059be32..5a204a00a 100644 --- a/app/views/platforms/platforms/build_all.html.haml +++ b/app/views/platforms/platforms/build_all.html.haml @@ -19,7 +19,7 @@ .both %h3= t("activerecord.attributes.build_list.preferences") .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 %br diff --git a/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb b/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb new file mode 100644 index 000000000..d9e595b7f --- /dev/null +++ b/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb @@ -0,0 +1,5 @@ +class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration + def change + change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 5ed652d33..d02f68ff8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.integer "user_id", :null => false @@ -215,11 +215,11 @@ ActiveRecord::Schema.define(:version => 20120523113925) do create_table "mass_builds", :force => true do |t| t.integer "platform_id" t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "arch_names" t.integer "user_id" - t.boolean "auto_publish" + t.boolean "auto_publish", :default => false, :null => false end create_table "platforms", :force => true do |t|