Sha256: f3068ca9f06835ca0451d53141ae2ded18af18bb624c353a43890110a2b235e2
Contents?: true
Size: 741 Bytes
Versions: 1
Compression:
Stored size: 741 Bytes
Contents
# SimpleController Use the Ruby on Rails Controller pattern outside of the Rails request stack. ## Installation Add this line to your application's Gemfile: ```ruby gem 'simple_controller' ``` And then execute: $ bundle Or install it yourself as: $ gem install simple_controller ## Usage ```ruby class UserController < SimpleController::Base before_action do @user = User.find(params[:user_id]) end def touch @user.touch @user end end UserController.call(:touch, user_id: 1) # => returns User object UserController.new.call(:touch, user_id: 1) # => same as above ``` It works like a Rails Controller, but has only has the following features: - Callbacks - `params` - `action_name`
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_controller-0.1.0 | README.md |