23

I cannot find the meaning of the keyword "mount" in Rails routing system.


I have set up Mercury to use within my Rails application. It added this line to my routes.rb config file:

Appname::Application.routes.draw do
  mount Mercury::Engine => '/'

What does the mount keyword mean?

Gabriel S.
  • 1,961
  • 2
  • 20
  • 30

2 Answers2

24

Mount within the Rails routes does the equivalent of a Unix mount.
It actually tells the app that another application (usually a Rack application) exists on that location.

It is used mostly for Rails Engines.

Flip
  • 6,233
  • 7
  • 46
  • 75
xlembouras
  • 8,215
  • 4
  • 33
  • 42
12

Mounting an engine means that the functionality from that engine is available inside your application.

See http://guides.rubyonrails.org/engines.html#mounting-the-engine

sevenseacat
  • 24,699
  • 6
  • 63
  • 88