On Wed, May 19, 2010 at 11:07 AM, chewmanfoo <chewman...@gmail.com> wrote:

> Guys,
>
> I have created a new controller Worker which has a method
> do_work(inputs), and another method show_work, which has a meaningful
> associated view (showing the results of the 'work'.
>
> So, I need to display the result of show_work in the view of another
> class called Consumer.
>
> So, I need to do a number of things:
>
> 1.) setup inputs (a hash) in the Consumer controller.
> 2.) have the consumer controller show method call Worker's method
> do_work(inputs)
> 3.) have the consumer show view show the results of show_work
>
> So, 2.) how do you call Worker.do_work(inputs)?  Do I instantiate a
> Worker class and then call obj_name.do_work(inputs)?
>

You can create a class method on the Worker's model.  For example,

def self.do_work( inputs )
   ...
end


> 3.) can I make use of the rendering going on in the show_work view in
> another classes show view?
>
>
You can create a shared partial that can be rendered within the show
template of the different controllers.  Also, you can find alot of
information
on guides.rubyonrails.org

Good luck,

-Conrad


> Thanks in advance!
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to