How embarrassing, a simple mistake. I defined the check_to_display method as follows:
def check_to_display
obviously it should have been
def self.check_to_display
And for those interested in common code:
class Param < ActiveRecord::Base unloadable def self.check_to_display(p) cf = CustomField.where("type='ProjectCustomField' and name='THE_FLAG'").first return false if cf.nil? return false if p.nil? cv = CustomValue.where("customized_type='Project' and customized_id=? and custom_field_id=?",p.id,cf.id).first return false if cv.nil? return false if cv.value.nil? cv.value.strip! return cv.value != "" end end
and don't forget, init.rb should look like this:
menu :project_menu, :info, {:controller=>'info', :action=>'index'}, :caption=>'Ticker', :after=>:activity, :param=>:project_id, :if=>Proc.new{|p|Param.check_to_display(p)}
source share