i have a controller like this:
class SpoilageController < DataEntryController
before_filter { check_access_key(''_SP'') }
...
and in the parent class is this:
class DataEntryController < ApplicationController
def check_access_key(key)
if !@session[:user].admin &&
!@session[:user].data_entry_access.to_s.upcase.include?(key)
render :text=>''You dont have access to this
function'',
:layout=>true
false # disallow
end
end
...
But it crashes, with this error:
undefined method `check_access_key'' for SpoilageController:Class
Why can''t the spoilage class see the function in its parent class?
whats going on?
--
Posted via http://www.ruby-forum.com/.
Mark Reginald James
2006-Mar-08 23:24 UTC
[Rails] Re: inheritance problem with controllers
chris wrote:> class SpoilageController < DataEntryController > before_filter { check_access_key(''_SP'') } > ... > But it crashes, with this error: > undefined method `check_access_key'' for SpoilageController:ClassTry: before_filter { |controller| controller.check_access_key(''_SP'') } -- We develop, watch us RoR, in numbers too big to ignore.