Asset Compiling Crashing on Server Environment With: "Nomethoderror: Undefined Method '[]' for Nil:Nilclass"

Asset compiling crashing on server environment with: NoMethodError: undefined method `[]' for nil:NilClass

I had the samme issue and it turned out to be a css file containing asset-url that didnt have the .scss extension. Weirdly I could compile the assets locally but not on the server.

Sinatra NoMethodError at / undefined method `stylesheet_link_tag' for #

Your problem is that stylesheet_link_tag and javascript_include_tag are a part of ActionView, one of the gems underlying Rails (i.e. see ActionView::Helpers::AssetTagHelper).

According to the sinatra-asset-pipeline documentation:

Now when everything is in place you can use all helpers provided by
sprockets-helpers

Looking at a sprocket-helpers example you need to do something like this:

<link rel="stylesheet" href="<%= stylesheet_path 'application' %>">
<script src="<%= javascript_path 'application' %>"></script>

So what you're looking for is stylesheet_path and javascript_path rather than stylesheet_link_tag and javascript_include_tag.

NoMethodError - undefined method `id' for nil:NilClass:

This means there is no entry in you Number table with specified twilio_sid.

there are multiple method to avoid this error:

One is:

number = Number.find_by_twilio_sid(params[:sid])
forward_name = Number.find_by_parent_id(number.try(:id)).try(:name)
erb "#{forward_name}"


Related Topics



Leave a reply



Submit