Application.rb methods not accessible

For some reason I seem to be unable to call methods defined in
application.rb

All controllers are supposed to inherit from application.rb correct?

I have a bit of code that does some filtering and I want it accessible
from any controller however when I try to call it, it fails.

show how you’ve defined it in application.rb and how you’re calling
from your controller.

application.rb
def desired_columns(model, fields, omit = true)
columns = model.constantize.content_columns.collect do |
content_column|
if omit
for field in fields
if content_column.name != field
content_column
end
end
else
for field in fields
if content_column.name == field
content_column
end
end
end
end

return columns.compact!

end

Here is where I’m calling it this is in a controller:

def details
@user = session[:user]

@columns = desired_columns("User", ["salt", "hashed_password"])

end

that looks correct… make sure your application.rb starts with
class ApplicationController < ActionController::Base

and other controllers start with
class MyController < ApplicationController

I have this problem too, which I believe I have previously posted here.
Still no solution.

Glen wrote:

For some reason I seem to be unable to call methods defined in
application.rb

All controllers are supposed to inherit from application.rb correct?

I have a bit of code that does some filtering and I want it accessible
from any controller however when I try to call it, it fails.

what version OS/ruby/rails? i’d probably back up my project, nuke
ruby and rails and reinstall them.

On Aug 15, 11:53 am, Brian A. [email protected]