Basic ruby inheritance question

I had a question over at the active scaffold forum no one was biting
on so I thought I’d try here. In the example below the
create_authorized? is called by active scaffold to determine if links
should display in the ui.

This example works as I expect:

class FooController < ApplicationController

def create_authorized?
authorized?(‘create’)
end
end

but if I try to move this method to ApplicationController like shown
below the method is not called:

class ApplicationController < ActionController::Base

def create_authorized?
authorized?(‘create’)
end
end

Maybe if I understood more how ruby/oop works, I could figure this
out. Can anyone tell me how this is possible.

is it accidentally under a private declaration in
ApplicationController?

good thought, but I tried the following, which should prove that out,
no?

class ApplicationController < ActionController::Base

protected
def create_authorized?
authorized?(‘create’)
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs