0.0
No commit activity in last 3 years
No release in over 3 years
A gem for Ruby Rails client side validations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 0
 Project Readme

Rapscallion

Ruby on Rails client side validations

Add Rapscallion to application.js:

//= require rapscallion/validations

Activate in Javascript:

$(selector).rapscallion();

Options:

  • Change class of error message div
    error_message_container_class: "error_messages"

  • Set a class on field with error
    field_with_error_class: 'has_error'

  • Set a class on field with success
    field_valid_class: 'is_valid'

  • Container for input – used to add and remove error messages
    field_container: 'div.input'

  • Event that triggers validation
    trigger: 'blur'

eg $('.rapscallion').rapscallion({error_message_container_class: 'errors', field_container: '.field'})

Add Rapscallion to Gemfile:

gem 'rapscallion'

View example of input tag with Simple Form:

.input
  = f.input :username, input_html: {class: 'rapscallion'}

Form tag when validating an existing record (for example to avoid uniqueness validation problems):

= simple_form_for @thing, html: {data: {existing_record: @thing.id}} do |f|

Model:

class User < ActiveRecord::Base
	validate :username, presence: true
end