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

decorate_resource

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decorate_resource

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

DecorateResource

It decorates your idiomatic Rails controller resources by running them through a decorator.

Installation

Add this line to your application's Gemfile:

gem 'decorate_resource'

And then execute:

$ bundle

Or install it yourself as:

$ gem install decorate_resource

Usage

Your controllers will gain a decorate_resource macro that will take your instanciated variables and run them through an appropriately named decorator. Here's a before and after:

Before:

class UsersController < ApplicationController
  load_resource

  def index
    @users # [User, User, ...]
  end

  def show
    @user # User
  end
end

After

class UsersController < ApplicationController
  load_resource
  decorate_resource

  def index
    @users # [UserDecorator, UserDecorator, ...]
  end

  def show
    @user # UserDecorator
  end
end

License

MIT

FAQs

Package last updated on 26 Aug 2012

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