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

rails_namespace_path_helper

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_namespace_path_helper

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RailsNamespacePathHelper

An extension for namespaced controllers

Namespacing is a common pattern in rails, however...

Rails does not account for namespacing when looking for helpers on controllers

  • Eg. for Admin::TasksController
    • helpers are declared admin_tasks_url
    • however rails bolierplate expects tasks_url to be available

This gem dynamically creates aliases for these methods so that nothing needs to be reconfigured

Usage

To use simply call:

  • has_namespaced_paths at the top of each controller with a namespace
  • or has_namespaced_path_plural / has_namespaced_path_singular for only plural/singular paths

Like this:

# in controllers/admin/tasks_controller.rb
class Admin::TasksController < ApplicationController
  has_namespaced_paths

  ...

end

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add rails_namespace_path_helper

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install rails_namespace_path_helper

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/benenb/rails_namespace_path_helper.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 10 May 2024

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