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
Jruby: Import VS Include VS Java_Import VS Include_Class
How to Get the Unique Elements from an Array of Hashes in Ruby
How to Bypass Mass Assignment Protection
Why Does Openuri Treat Files Under 10Kb in Size as Stringio
How to Access Class Variables in Ruby 1.9
Ruby on Rails: How to Check If a File Is an Image
How to Validate the Presence of a Belongs to Association with Rails
How to Install Ruby 1.9.3 on Ubuntu Without Rvm
Rails 4 User Roles and Permissions
Rails 3 Joins -- Select Only Certain Columns
Weird Rails Error "Permission Denied: Bin/Rails" for Old Rails Apps
Adding a Submit Button Image to a Rails Form
How to Handle Multiple Models in One Rails Form
Ruby Create Recursive Directory Tree