Project

irreverent

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Add i18n and some more magick to the responses with respond_with
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0
 Project Readme

Irreverent

Rails responder customization (Inspired by Jose Valim's Crafting Rails 4 Apps Book)

The whole purpose is to use I18n in you flash messages, using only respond_with in the controller

Build status Build Status

Installation

Just add it to your Gemfile:

gem 'irreverent'

You should override the default Rails scaffold generator with:

rails generate irreverent:install

Customization

Edit your locales to add a generic flash response:

en:
  flash:
    actions:
      create:
        notice: '%{resource_name} was successfully created'
        alert:  ''
      update:
        notice: '%{resource_name} was successfully updated'
        alert:  ''
      destroy:
        notice: '%{resource_name} was successfully destroyed'
        alert:  '%{resource_name} could not be destroyed'

You can customize it for one particular controller like this:

en:
  flash:
    users:
      create:
        notice: 'You just create a new user!'
      update:
        notice: 'You change it'
      destroy:
        notice: 'The user is no more'
        alert:  'You can not delete it'

Released under the MIT LICENSE