Skip to content
Cloud Castle's Gem Toolbox
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
custom_column_types
db_assets_manager
email_validator
js_routes
jss_template
monkey_patcher
request_variables
retryable
sexy_hash
strip_number_fields
.gitignore
README.md

README.md

db_assets_manager

Easily work with views and functions.

Put plain SQL queries for views into RAILS_ROOT/db/views/<view_name>.sql
Put function declarations into RAILS_ROOT/db/functions/<function_name>.sql

You can create/destroy assets using db:assets:create and db:assets:destroy rake tasks. Also, db:assets:create runs automatically after db:migrate.

jss_template

Provides plain templates to clientside JS.

Put HTMLs you want in JS somewhere in assets subdirectory, give them jss extension.
They will be bundled into JSS top-level JavaScript object respecting paths to them.

For example, app/assets/javascripts/templates/posts/index.jss will be available as String by JSS.templates.posts.index.

js_routes

Provides access from js code to all your application named routes. In Rails version > 3.1 just require 'routes.js' in your js files or directly include it into view.

You can hide some important routes from js, for example: get '/some_secret_route', :to => 'secret_controller#secret_action', :hidden => true

monkey_patcher

Requirer and autoreloader (in development) for monkey patches. Just put your monkey patch files into /lib/monkey_patches directory and relax.

email_validator

Email validation support (see http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/ for details). Usage: validates :user_email, email: true

retryable

Options:

  • :tries - Number of retries to perform. Defaults to 1.
  • :on - The Exception on which a retry will be performed. Defaults to Exception, which retries on any Exception.
  • :sleep - Interval between tries in sec. Defaults to 1.

Usage:

retryable(:tries => 1, :on => OpenURI::HTTPError) do
    # your code here
end

request_variables

Add remember declaration to application_controller (or somewhere)

class ApplicationController
  include RequestVariables::Support
  remember_request_variables :current_user
end

Use variables anywhere RequestVariables.current_user

Installation:

git "git://github.com/cloudcastle/toolbox.git" do
  gem "db_assets_manager"
  gem "jss_template"
end
Something went wrong with that request. Please try again.