In my Development mode, when i pre-compile the application's assets using the command
rake bundle exec rake assets:precompile RAILS_ENV=production --trace
I am getting the following error
NoMethodError: undefined method '[]' for nil:NilClass
/home/sable/.rvm/gems/ruby-2.3.0/gems/sprockets-3.6.3/lib/sprockets/sass_processor.rb:278:in `sprockets_context'
/home/sable/.rvm/gems/ruby-2.3.0/gems/sprockets-3.6.3/lib/sprockets/sass_processor.rb:124:in `asset_path'
/home/sable/.rvm/gems/ruby-2.3.0/gems/sprockets-3.6.3/lib/sprockets/sass_processor.rb:137:in `asset_url'
/home/sable/.rvm/gems/ruby-2.3.0/gems/sprockets-3.6.3/lib/sprockets/sass_processor.rb:155:in `image_url'
/home/sable/.rvm/gems/ruby-2.3.0/gems/sass-3.4.22/lib/sass/script/tree/funcall.rb:143:in `_perform'
When i run my server in the development mode using the rails s command there is an error that i think might be the cause of the the pre-compile error which is the following
ActionController::RoutingError (No route matches [GET] "/javascripts/defaults.js"):
I read through the rails assets pipeline and sprockets but i can't seem to wrap my head around everything and solve the problem as i am new to the rails framework, any direction or help would be appreciated.
Solution I have edited the file
/home/sable/.rvm/gems/ruby-2.3.0/gems/sprockets-3.6.3/lib/sprockets/sass_processor.rb
like, from line 120, i added the line "puts 'path'" on line 122 so that i can see the path where the pre-compilation error is coming from
def asset_path(path, options = {})
path = path.value
puts path........
i saved the file and then again ran
rake bundle exec rake assets:precompile RAILS_ENV=production --trace
i saw that i was using a sasss helper method 'image-url' in a css file so the pre-compiler could not somehow get to that file, i created a a new file with extension css.scss, this solved my problem, i can't explain it any better because i don't really understand it fully but managed to follow from people's experiences, checkout,http://guides.rubyonrails.org/asset_pipeline.html#css-and-sass and How to reference images in CSS within Rails 4.