Merge pull request #507 from warpc/442-mass_build
[refs #442] Fix auto_publish validate and set default value
This commit is contained in:
commit
83100938c6
|
@ -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"))
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false
|
||||||
|
end
|
||||||
|
end
|
|
@ -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|
|
||||||
|
|
Loading…
Reference in New Issue