简体   繁体   中英

Render layout without a template in Rails

I have a rails application that is using ember and in my routes I have all routes going to application#ember . This requires me to have an empty application/ember.html.erb (which is empty). It's only there to appease rails and let ember start.

How do I render the layout without an associated template?

routes.rb

match '*path' => 'application#ember', via: %i[get post]

views/application/ember.html.erb

# empty! I only exist to make rails happy!
render html: '', layout: true

重要的是要注意layout: true需要layout: true部分

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM