Wednesday, April 4, 2012

Re: [Rails] call a function in application controller

On 4 April 2012 08:37, amvis <vgrkrishnan@gmail.com> wrote:
> 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?

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate