Ruby on Rails Wednesday, June 1, 2011

OK...I still have a problem:

The render_to_string method is only available in controllers and not
in models and views!!!

My approach was to check with several delayed_job my database entries
for changes (compare with external webservice!) and then run a
delayed_job for create the report with lower priority afterwards.

That is not working because I can't use render_to_string in a model
for the delayed_job.

Has anyone an idea how to solve this?

Or is it possible to delay a method from another controller?

I am so close! If I just call the method on a view the whole page is
stored as I want. I only need to do this in a delayed_job...!

@Colin Law: I had a look into caching, but I didn't understand the
whole thing, so I think for me it would be easier if my first approach
would work.

Sebastian

On May 26, 11:51 am, Sebastian <sebastian.go...@googlemail.com> wrote:
> render_to_string worked perfectly!
>
> I just have to this in the controller and not in the view.
>
> Controller:
>
> @reportstring = render_to_string(:partial => "shared/
> compare", :collection => @changedfamilies)
>
> Then I can save the @reportstring in my database and call the whole
> view wherever I need it!
>
> Thank you!
>
> On May 26, 10:17 am, Colin Law <clan...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > On 26 May 2011 08:51, Sebastian <sebastian.go...@googlemail.com> wrote:
>
> > > Thank you all for your answers.
> > > ...
> > > @Colin Law: Cache is only temporarily. I need to save the report
> > > permanently, so cache is no option.
>
> > A page cache can be as permanent as you like.  It is up to you when
> > you expire it.  If you never expire it then it will be permanent.  By
> > doing it yourself you are just re-inventing the wheel.  The work has
> > already been done for you by Rails developers.
>
> > 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.

No comments:

Post a Comment