开发者

Suppress/Override application.html.erb

开发者 https://www.devze.com 2022-12-27 01:34 出处:网络
Is there any way to suppress the default js and css loaded by application.html.erb on a view by view basis? I\'m finding it incredibly difficult to manage a global css and js includes configuration wh

Is there any way to suppress the default js and css loaded by application.html.erb on a view by view basis? I'm finding it incredibly difficult to manage a global css and js includes configuration when certain views need different js libraries that for some reason seem to be conflicting with one another. For example, I might want jquery 1.3 for开发者_如何学C one view and 1.4.2 for another. I don't necessarily want to have to have an include for every view (I do want to have a global site-wide default), but I would also like to be able to override those for any view I want. Thanks!


# Renders the template for the action "long_goal" within the current controller,
# but with a custom layout
render :action => "long_goal", :layout => "spectacular"

See the documentation for render

So you could do this, for example:

def show
  respond_to do |wants|
    wants.html { render :action => 'show', :layout => 'other_layout' }
  end
end

But this is just a hacky bandaid. You should look into why the two versions of jQuery are conflicting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号