Class MyProfileController
In: app/controllers/my_profile_controller.rb
Parent: ApplicationController

Methods

Public Class methods

declares that the controller needs an specific type of profile. Example:

 class PersonDetailControlles < ProfileAdminController
   requires_profile_class Person
 end

The above controller will reject every request to it unless the current profile (as indicated by the first URL component) is of class Person (or of a subclass of Person)

[Source]

    # File app/controllers/my_profile_controller.rb, line 16
16:   def self.requires_profile_class(some_class)
17:     before_filter do |controller|
18:       unless controller.send(:profile).kind_of?(some_class)
19:         controller.instance_variable_set('@message',  _("This action is not available for \"%s\".") % controller.send(:profile).name)
20:         controller.send(:render, :file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'access_denied.rhtml'), :layout => true, :status => 403)
21:       end
22:     end
23:   end

[Validate]