Skip to content
daronco edited this page Apr 3, 2013 · 7 revisions

The routes to bigbluebutton_rails can be generated with the helper bigbluebutton_routes. See the example below:

bigbluebutton_routes :default

resources :users do
  bigbluebutton_routes :room_matchers
  resources :spaces do
    bigbluebutton_routes :room_matchers
  end
end

The first line generates the default routes. You need to call it at least once to generate the following routes:

bigbluebutton_routes :default

It generates routes scoped with "bigbluebutton". These routes look like:

/bigbluebutton/servers
/bigbluebutton/servers/my-server/new
/bigbluebutton/servers/my-server/rooms
/bigbluebutton/rooms
/bigbluebutton/rooms/my-room/join

You can generate routes for a single controller with:

bigbluebutton_routes :default, :only => 'servers'
bigbluebutton_routes :default, :only => 'rooms'
bigbluebutton_routes :default, :only => 'recordings'

If you want to use custom controllers (see How to: Inherit controllers) you can pass them with:

bigbluebutton_routes :default, :controllers => {
  :servers => 'custom_servers',
  :rooms => 'custom_rooms',
  :recordings => 'custom_recordings'
}

If you customize the controllers as in the first line in the example above, be aware that every route generated with bigbluebutton_routes after this will use these controllers.

You may also want shorter routes to access conference rooms. For that, use the option room_matchers:

resources :users do
  bigbluebutton_routes :room_matchers
end

It creates routes to the actions used to access a conference room, so you can allow access to webconference rooms using URLs such as:

http://myserver.com/my-community/room-name/join
http://myserver.com/user-name/room-name/join

The helpers in the gem also offer the possibility to change the scope in which the routes will be created and how the route helpers will be named. For example:

bigbluebutton_routes :default, :scope => 'webconference', :as => 'bigbluebutton'

Will create routes similar to these:

    bigbluebutton_servers GET    /webconference/servers(.:format)               bigbluebutton/servers#index
 new_bigbluebutton_server GET    /webconference/servers/new(.:format)           bigbluebutton/servers#new
edit_bigbluebutton_server GET    /webconference/servers/:id/edit(.:format)      bigbluebutton/servers#edit
  join_bigbluebutton_room GET    /webconference/rooms/:id/join(.:format)        bigbluebutton/rooms#join
   new_bigbluebutton_room GET    /webconference/rooms/new(.:format)             bigbluebutton/rooms#new
                          ...    ...

You can see that URL will be changed to use webconference while the helpers will still be named withbigbluebutton. We do not recommend to change the value of :as, use always bigbluebutton! If you change it, the controllers in this gem will fail to find the routes they need and won't work properly.

For more information, see the documentation in the file routes.rb.

Clone this wiki locally