Sunday, October 20, 2013

Re: [Rails] Render html withouts assets

On Oct 19, 2013, at 7:19 AM, Danil Fomichev <siblynx@gmail.com> wrote:

> Hi,
>
> Is there a way to render template without assets from application.js and application.css?

You can specify a different layout that does not include these, or…

>
> In my project I use html rendered by controllers. This data is received by ajax and added to current page interactively. The problem is that html contains unnecessary data with js and css files. I need only HTML from the view template.


If this is just a chunk of html, not a complete document, then you can render with no layout at all. In your controller, do:


class MyApiController < ApplicationController
layout false

….

end

Then there will be no layout for that entire controller.

See http://edgeguides.rubyonrails.org/layouts_and_rendering.html

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/E72B073B-DB72-47E0-955A-2B51E18C2EAD%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate