werein / x-editable-rails

Edit fields easily with X-Editable helper

Home Page:https://wereinhq.com/guides/x-editable-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding validation when editing

Rubioli opened this issue Β· comments

Great gem πŸ‘

In my application I use client_side_validations gem for validating my form. Am I able to also use client_side_validations gem or other sort of validation to x-editable-rails?

I just want to validate, :price & :number & both of them can't be less the $0.010.

Currently in my Product model, I do:

class Product < ActiveRecord::Base
  validates :price, :number, numericality: {greater_than_or_equal_to: 0.010}

As I see it if I insert anything greater then 0.010, field gets updated, but if I for instance insert 0.0009, the field doesn't get updated (That's good), but no error is showing and the loading gear is just going around.

How can I show the error message when validation fails?

Any help is appreciated & thanks in advanced!