Skip to content

abigoroth/before_renders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

before_renders Gem Version

If Rails before_filter or after_filter doesn't enough, try before_renders. Tested in Rails 5.1.4

Installation

In your Gemfile:

gem 'before_renders'

or system wide:

$ gem install before_renders

Usage

Now you can execute methods before your rails application start to render anything. Example in application controller like below :

class ApplicationController < ActionController::Base
    before_render :set_layout

    def set_layout
        # ...
    end
end

You can also use in concerns like so:

module PrintableController
  extend ActiveSupport::Concern

  included do
    before_render :update_gst_sum, only: [:new, :show, :print_rf]
  end
end

About

Calls method right before rendering

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published