Socket
Book a DemoInstallSign in
Socket

coffee_routes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffee_routes

1.1.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

CoffeeRoutes

Access your Rails named routes from coffeescript. Read about the making of here.

Installation

Add this line to your application's Gemfile:

gem 'coffee_routes'

And then execute:

$ bundle

Or install it yourself as:

$ gem install coffee_routes

Usage

Include coffee_routes in your application.coffeee

#= require coffee_routes

You should now have the CoffeeRoutes object in your global javascript scope.

To access a named route, you can use the CoffeeRoute.path helper directly or you can use the global _path helper that is attached to window that you can call just like you would when writing a rails view.

CoffeeRoutes.path('project_item')
=> "/projects/:project_id/item/:id"

project_item_path()
=> "/projects/:project_id/item/:id"

To substitute in the parameter values pass in a hash.

CoffeeRoutes.path('project_item', {"project_id" : "project-awesome", "id" : 5})
=> "/projects/project-awesome/items/5"

project_item_path({"project_id" : "project-awesome", "id" : 5})
=> "/projects/project-awesome/items/5"

You can also get the HTTP verb that should be used with the named route.

CoffeeRoutes.method('project_item')
=> "GET"

FAQs

Package last updated on 23 Oct 2014

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.