call a function in application controller

20 views
Skip to first unread message

amvis

unread,
Apr 4, 2012, 3:37:41 AM4/4/12
to rubyonra...@googlegroups.com
class BranchesController < ApplicationController

    def create

      //call for_branch with argument pass
    end

end

class ApplicationController < ActionController::Base

      def for_branch(branch)
      end

end

In the above code, i have to call one function which is in application controller, from one controller. how to call this...its like in all other oop language, create one object of an extended class and call the object. so can i do like that?


Thank you
vishnu

Colin Law

unread,
Apr 4, 2012, 4:36:20 AM4/4/12
to rubyonra...@googlegroups.com

From the BranchesController you can just call for-branch as
BranchesController is derived from ApplicationController. If it does
not work for you post the code and full error.

Colin

Reply all
Reply to author
Forward
0 new messages