You dont need to inherit from ApplicationController. Stop inheriting it, it will start working.
If you want to initialise the attribute in all actions, all you have to do is this
class Metric
attr_accessor :capability, :behavior
def initialize(family_id)
@capability = 5
end
end
class ApplicationController < ActionController::Base
before_action :initialize_metric_attribute
def initialize_metric_attribute
@capability = Metric.new(10)
end
end
Edit based on comment:
You are inheriting from ApplicationController. It should only be inherited only when you want to write some action. For writing custom classes,you dont need to do anything. If required you can inherit ActiveRecord::Base.
Since, you are have initialize method in your class metric class, you dont even need AR.
Why it worked ?
We have just used before_filter callback which initialize your attribute. its Simple Ruby and Rails concept.
ApplicationControllerhas no method with such name?