views:

166

answers:

1

I am new to Ruby and RoR. I am not really understand how the controllers work.

I have an action in ApplicationController

def some_checking
  ...
end

And I would like to call the action some_checking in another controller

class OtherController < ApplicationController

  some_checking

  def xxx
  end

end

Is there anything wrong? How can I call an action in ApplicationController? I just can't get into some_checking.

+3  A: 

I'm not quite sure on what you want to do. If I've understood you've defined a method on ApplicationController and you want it to be called inside OtherController. To do this you can both use before_filter or just call the method from inside the xxx method itself.

Take a look to available filters here http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html

Francisco
thanks. i forgot i have to use before_filter in such case. >.<
siulamvictor