Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails3_before_render_mlp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails3_before_render_mlp

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Rails3 Before Render Build Status Code Climate

Supports Rails 3 & 4

Introduction

Add a hook like before_filter to your controllers that gets executed between when your action is completed and the template is rendered. It can really DRY up loading some data that is used for views (headers / layouts / etc).

Plugin was inspired by before_render by Todd Willey, which works for rails2 only. New ActiveSupport::Callbacks methods were used, in analogy with ActionDispatch.

Provided methods:

  • before_render
  • prepend_before_render
  • skip_before_render

Installation

gem 'rails3_before_render'

Warning: Rails 3 & 4 only. Rails2 users can use before_render by Todd Willey.

Usage

before_render / prepend_before_render / skip_before_render works as other filters. Options like :except and :only can be passed to filter.

class PostsController < ApplicationController
  before_render :ping, :except => [:destroy]

  def index; end

  def new; end

  def show; end

  def destroy; end

  private
    def ping
      Rails.logger.info "Ping-Pong actions"
    end
end

Method ping will be executed after your actions and before template is rendered.

TODO

  • Tests should not throw runtime error(happening right now if comment one of provided aliased methods)

FAQs

Package last updated on 05 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc