Skip to content

How to: Inherit controllers

daronco edited this page Apr 3, 2013 · 4 revisions

The process is the same whether you want to inheriting servers, rooms or recordings. This page shows an example for them all, but you don't necessarily need to do it for all.

The base controllers your controllers should inherit are

  • Bigbluebutton::ServersController
  • Bigbluebutton::RoomsController
  • Bigbluebutton::RecordingsController
# file: app/controllers/custom_servers_controller.rb
class CustomServersController < Bigbluebutton::ServersController
end
# file: app/controllers/custom_rooms_controller.rb
class CustomRoomsController < Bigbluebutton::RoomsController
end
# file: app/controllers/custom_recordings_controller.rb
class CustomRecordingsController < Bigbluebutton::RecordingsController
end

Change your routes.rb to use the new controllers:

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

See routes for more information on how to customize your routes.

The views for this controller should be at app/views/custom_servers/, so you need to move BigbluebuttonRails' views to the new custom paths:

mv app/views/bigbluebutton/servers/ app/views/custom_servers/
mv app/views/bigbluebutton/rooms/ app/views/custom_rooms/
mv app/views/bigbluebutton/recordings/ app/views/custom_recordings/

If you don't have the BigbluebuttonRails views in your application yet, you can generate them with:

rails generate bigbluebutton_rails:views
Clone this wiki locally