You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
654 B
16 lines
654 B
5 years ago
|
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
|
||
|
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
|
||
|
validates :contact_phone, presence: true
|
||
|
end
|