asset-pipeline

Heroku + Rails 3.1: asset_path undefined?

别说谁变了你拦得住时间么 提交于 2019-12-23 04:32:09
问题 i try to deploy a rails 3.1.3 app to heroku but keep getting the following error when browsing the pages: ActionView::Template::Error (undefined method `asset_path' for #<#<Class:0x00000002ecd630>:0x00000002e52480>): i use the "cedar" stack as recommended by heroku. any idea why i get this issue? do i have to make some more configuration? thanks in advance! EDIT: works again. i forgot to add "require 'sprockets/railtie'" in the application.rb... 回答1: You forgot to add "require 'sprockets

Heroku + Rails 3.1: asset_path undefined?

回眸只為那壹抹淺笑 提交于 2019-12-23 04:30:05
问题 i try to deploy a rails 3.1.3 app to heroku but keep getting the following error when browsing the pages: ActionView::Template::Error (undefined method `asset_path' for #<#<Class:0x00000002ecd630>:0x00000002e52480>): i use the "cedar" stack as recommended by heroku. any idea why i get this issue? do i have to make some more configuration? thanks in advance! EDIT: works again. i forgot to add "require 'sprockets/railtie'" in the application.rb... 回答1: You forgot to add "require 'sprockets

The stylesheet broken when loading different layout in different controllers

邮差的信 提交于 2019-12-23 04:11:49
问题 Hi I got a strange problem. When I clicked three pages shown in the following three images Step 1 controller welcome Step 2 other controllers Step 3, go back to the step1 view controller welcome The last image, when I back to controller welcome from the other controllers ,that is step 2 to step 3. The stylesheets were cached by the browser, The step 3's layout is differ to step1 layout. But they are the same page,How could it be, it seems the browser caches the css files ? I add two assets

Rails: Is it possible to get the controller and action name from an asset file?

只愿长相守 提交于 2019-12-23 02:26:09
问题 I want to do something like this in my asset pipeline: application.js //= require jquery //= require jquery_ujs //= require_tree ./includes //= require global <% if File.exists? "#{Rails.root}/assets/javascripts/#{params[:controller]}.js" %> //= require <%= params[:controller] %> <% end %> <% if File.exists? "#{Rails.root}/assets/javascripts/#{params[:controller]}/#{params[:action]}.js" %> //= require <%= params[:controller] %>/<%= params[:action] %> <% end %> Now this doesn't work because

Rails asset pipeline working with fonts and yarn

徘徊边缘 提交于 2019-12-23 01:02:02
问题 I have an existing rails application where I am working on a separate branch to implement yarn for managing my vendor assets. My app stack is: ruby-2.4.0 rails 5.1.4 node 9.4.0 yarn 1.3.2 After installing yarn, I ran yarn init and it generated a package.json in the project root. After a few packages added, it looks like: # package.json { "name": "my-project-name", "version": "1.0.0", "private": true, "repository": "my-repo", "author": "me", "license": "MIT", "dependencies": { "bootstrap": "3"

run rake task inside rails application

天大地大妈咪最大 提交于 2019-12-22 17:37:32
问题 I want to run asset precompile task inside the rails application,As I had many dependencies who will change the code,in that case all the time whenever they change i need to run the script as I cant give server access to them so I am providing the GUI for them from that they alone can run the script,so,I have built UI to run the task with some parameter like system("Template='#{params[:template]}' Theme='#{params[:theme]}' rake assets:precompile) I am getting two values from UI(params[

Remove development gems from production with Bundler and Rails 4

最后都变了- 提交于 2019-12-22 10:23:39
问题 Problem Our deployed application has development dependencies in it. We have a lot of development dependencies. This increases the artifact size and the memory consumption in production, as all those dependencies are require 'd. Most instances are deployed in the cloud, so more memory = more money for larger instances. We would like to reduce the size/memory and make a more clear separation between the deployed artifact and the development environment. A particular focus is the need for

Include custom folder specific assets in ruby on rails

主宰稳场 提交于 2019-12-22 09:35:57
问题 I am trying to create separate folders for keeping the assets related to backend and frontend. I planned the following folder structure: app/assets/dashboard/javascripts instead of the usual one app/assets/javascripts . Backend is served via app/views/layouts/dashboard.html.erb , and includes the assets in the following way: <%= stylesheet_link_tag 'dashboard/dashboard', params[:controller], media: 'all' %> <%= javascript_include_tag 'dashboard/dashboard', params[:controller] %> Front end is

Include custom folder specific assets in ruby on rails

橙三吉。 提交于 2019-12-22 09:33:32
问题 I am trying to create separate folders for keeping the assets related to backend and frontend. I planned the following folder structure: app/assets/dashboard/javascripts instead of the usual one app/assets/javascripts . Backend is served via app/views/layouts/dashboard.html.erb , and includes the assets in the following way: <%= stylesheet_link_tag 'dashboard/dashboard', params[:controller], media: 'all' %> <%= javascript_include_tag 'dashboard/dashboard', params[:controller] %> Front end is

Using a jQuery UI Theme with Rails 4 - No Images being served

蹲街弑〆低调 提交于 2019-12-22 07:58:18
问题 I am currently using Rails 4.0.2 with jQuery UI (mostly for the datepicker). My production environment is Heroku. My main problem is that the images for my theme are not being served in production (while it works fine in development). I am including the theme's css like this in my application.css : *= require_self *= require_tree . *= require jquery-ui-1.10.4.custom The theme's css is showing up fine, but none of the images are working. I have read through endless questions on StackOverflow,