mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
init project
This commit is contained in:
15
app/forms/project_packages/save_form.rb
Normal file
15
app/forms/project_packages/save_form.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class ProjectPackages::SaveForm
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_accessor :category_id, :title, :content, :attachment_ids, :deadline_at,
|
||||
:min_price, :max_price, :contact_name, :contact_phone, :code, :publish
|
||||
|
||||
validates :category_id, presence: true
|
||||
validates :title, presence: true, length: { maximum: 60 }
|
||||
validates :content, presence: true
|
||||
validates :deadline_at, presence: true
|
||||
validates :min_price, numericality: { greater_than: 0 }, allow_blank: true
|
||||
validates :max_price, numericality: { greater_than: ->(obj){ obj.min_price.to_i } }, allow_blank: true
|
||||
validates :contact_name, presence: true, length: { maximum: 20 }
|
||||
validates :contact_phone, presence: true, format: { with: /1\d{10}/ }
|
||||
end
|
||||
Reference in New Issue
Block a user