ActionView::Template::Error (ui.jqgrid isn't precompiled) Rails

时间:2021-02-09 20:41:56

I'm Running my application using nginx server and passenger,

我正在使用nginx服务器和乘客运行我的应用程序,

ActionView::Template::Error (ui.jqgrid isn't precompiled):
    21:         <%= stylesheet_link_tag "new" %>
    22:         <%= stylesheet_link_tag "jquery-ui-1.8.16.custom.css" %>
    23:         <%= stylesheet_link_tag "buttons"%>
    24:         <%= stylesheet_link_tag "ui.jqgrid"%>
    25:         <%= stylesheet_link_tag "jquery.multiselect.css"%>
    26:         <%= stylesheet_link_tag "jquery.multiselect.filter.css"%>

I have pre-compiled all my assets.I have included following code in my application.rb file

我已预编译了所有资产。我在application.rb文件中包含以下代码

config.assets.precompile << Proc.new do |path|
    if path =~ /\.(css|js)\z/
        full_path = Rails.application.assets.resolve(path).to_path
        app_assets_path = Rails.root.join('app', 'assets').to_path
        if full_path.starts_with? app_assets_path
          puts "including asset: " + full_path
          true
        else
          puts "excluding asset: " + full_path
          false
        end
    else
        false
    end
    end

I public/assets can see its compiled version, but still I'm getting message that file is not pre compiled.

我公共/资产可以看到它的编译版本,但我仍然收到文件未预编译的消息。

public/assests/ui.jqgrid-4a84577046aa358c9ee125bf6a1a85de.css
public/assests/ui.jqgrid-4a84577046aa358c9ee125bf6a1a85de.css.gz
public/assests/ui.jqgrid.css
public/assests/ui.jqgrid.css.gz  

Update: My manifest.yml

更新:我的manifest.yml

ui.jqgrid.css: ui.jqgrid-4a84577046aa358c9ee125bf6a1a85de.css
ui.multiselect.css: ui.multiselect-18d6d97e6b62659bfd94b81d54ed7ec0.css

On my local machine its works fine, but when I deploy my code on production server(nginx + passenger) its crashing.

在我的本地机器上它工作正常,但当我在生产服务器(nginx +乘客)上部署我的代码时崩溃。

Please suggest...

1 个解决方案

#1


1  

When you are including CSS or JS file, if that file name contains dot then it assume that its a file extension, here it is assuming jqgrid as file extension,

当您包含CSS或JS文件时,如果该文件名包含点,则它假定它是文件扩展名,这里假设jqgrid为文件扩展名,

So just change <%= stylesheet_link_tag "ui.jqgrid"%> To

所以只需更改<%= stylesheet_link_tag“ui.jqgrid”%> To

<%= stylesheet_link_tag "ui.jqgrid.css"%>

And it works !!!

它的工作原理!

#1


1  

When you are including CSS or JS file, if that file name contains dot then it assume that its a file extension, here it is assuming jqgrid as file extension,

当您包含CSS或JS文件时,如果该文件名包含点,则它假定它是文件扩展名,这里假设jqgrid为文件扩展名,

So just change <%= stylesheet_link_tag "ui.jqgrid"%> To

所以只需更改<%= stylesheet_link_tag“ui.jqgrid”%> To

<%= stylesheet_link_tag "ui.jqgrid.css"%>

And it works !!!

它的工作原理!