Thursday, May 26, 2011

[Rails] Re: Store a whole page as html in database

Sebastian wrote in post #1001166:
> 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!

Do you need this solution to scale? Fetching that large string from the
database is going to be far less efficient than Colin's suggestion about
using page caching. The web server was designed to be highly efficient
at serving static HTML content (i.e the cached pages). Using Rails and
the database can't possibly match the performance of Apache or Nginx.

--
Posted via http://www.ruby-forum.com/.

--
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