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

laserlemon-router_bits

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

laserlemon-router_bits

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= router_bits

router_bits extends Rails routing conditions beyond the request's method. Conditions are created for commonly used attributes of ActionController::AbstractRequest such as: host, domain, subdomains and xhr?.

== Example

Conditionally route requests based on domain name:

map.with_options :controller => 'example', :conditions => {:domain => 'example.com'} do |map| map.root end

map.with_options :controller => 'sample', :conditions => {:domain => 'sample.com'} do |map| map.root end

Differentiate Ajax and non-Ajax requests:

map.with_options :controller => 'users' do |map| map.profile 'user/:id', :action => 'profile', :conditions => {:xhr => false} map.mini_profile 'user/:id', :action => 'mini_profile', :conditions => {:xhr => true} end

== Tips

  • Only extends routing conditions; not used in URL generation
  • Although often equivalent, host and domain represent two separate pieces of information. For a request to www.sub.domain.com the value for host is "www.sub.domain.com" while the value for domain is "domain.com".
  • The value for subdomains always returns an array. In the above case, subdomains would be ["www", "sub"].

FAQs

Package last updated on 11 Aug 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

  • 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