خرید بک لینک

Vote count: 0

Tell me whether it is possible somehow to deduce errors in the classical Active Model style?

Example show error

my method:

def update
    address = Address.find(@user.billing_address)
    form = AddressForm.new(address)
    if form.validate(params[:billing])
      form.save
    else
      flash[:notice] = form.errors.full_masseges
    end
  end

my form object:

class AddressForm < Reform::Form
  include Reform::Form::ActiveModel::Validations
  include Reform::Form::ActiveModel::FormBuilderMethods

  property :first_name
  property :last_name
  property :address
  property :city
  property :country_id
  property :zipcode
  property :phone

  extend ActiveModel::ModelValidations
  copy_validations_from Address

end

I would like to display error as top picture

asked 24 secs ago

برچسب: rails gem reform, نویسنده: استخدام کار تاريخ: سه شنبه 19 مرداد 1395 ساعت: 21:02

صفحه بندی