Issue with Dalli not working as expectd? - ruby-on-rails

I have a simple rails app and I am trying to save and retrieve keys from a memcache box, which was working for a long time unless we started encountering the error below, I have tried debugging this but will need someone to help now
[2015-10-28 12:25:46.649][ERROR] Unexpected exception during Dalli request: NoMethodError: undefined method `<<' for nil:NilClass (pid:58452)
[2015-10-28 12:25:46.649][ERROR] /Users/aupadhyay/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.2/lib/celluloid/proxy/async.rb:28:in `method_missing'
/Users/aupadhyay/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/marshal.rb:6:in `load'
Let me know incase anyone has insights to this ?

Related

Global error handler for specific case. Undefined method 'public_url'

ruby '2.5.1'
rails '5.1.7'
My project is for sound management. All uploaded files are in the cloud storage - sounds/sound images/album images and etc.
But some files on cloud storage are absent. And for following code in view:
.row
- #sounds.each do |sound|
.col-md-2
.play{ "image-src": "#{sound.image.url(:small)}", style: "background: url(#{sound.image.url(:small)});" }
I get following error:
ActionView::Template::Error (undefined method `public_url' for nil:NilClass)
There are a lot of such cycles (#sounds.each) in the project, so I would not want to rewrite each one.
How to write an error handler for such case? So that in absence of files in storage, sound is skipped.
Maybe there is a way to write code in application_controller.rb or something similar?
I use gem 'carrierwave-google-storage' for images and gem 'google-cloud-storage' for attachment.
It seems that there are some cases where the error ActionView::Template::Error (undefined method `public_url' for nil:NilClass) occurs.
Looking on the Community, it seems that there are some options/ways that can fix this error and it would depend on the way that your code and application is configured. For this reason, I would recommend you to take a look at the following posts and answers, to check if they help you. :)
ActionView::Template::Error: ActionView::Template::Error: undefined method `[]' for nil:NilClass
Railstutorial ActionView::Template::Error: undefined method `email' for nil:NilClass
Ruby on rails : undefined method `map' for nil:NilClass , what causes this? when i add record to table
Let me know if the information helped you!

ActionController : undefined method action_name for nil

I get this error arbitrarily during certain actions in my application. I feel this error is due to #app.call(env) in one of my middlewares.
NoMethodError (undefined method `action_name' for nil:NilClass):
vendor/cache/ruby/2.1.0/gems/actionpack-3.2.22/lib/action_controller/caching/sweeping.rb:84:in `callback'
vendor/cache/ruby/2.1.0/gems/actionpack-3.2.22/lib/action_controller/caching/sweeping.rb:59:in `before'
vendor/cache/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/callbacks.rb:325:in `around'
Here's the full-trace of exception.
Origin of exception according to trace.
Similar exception has been reported on google forum but I am not able to conclude anything out of it.
Why is this error even raised at first place ?
Any solution to avoid it ?
Trying to reproduce in a confined environment. Have anybody faced such issue and successfully reproduced it ? (Please share)

NoMethodError: undefined method `get' for #<Class:0xc3ba52c>

I have a project totally an api one returning json response. I have an affiliation table associated with other information. All information in my tables is being fetched through rake task. Now the issue is, the project was running fine but not now when I run a rake task it gives an error in .get method as such
NoMethodError: undefined method `get' for #<Class:0xc3ba52c>
/home/munam/.rvm/gems/ruby-2.1.4/gems/activerecord-4.1.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
Here I have used it :
#affiliation = Affiliation.get('my_key')
If I change this to
#affiliation = Affiliation.find_by_key('my_key')
It works fine. But unfortunately I do not have access rights to change in it. Moreover I do not understand why has that method stopped working just at a sudden.
I read about this over here:
http://api.rubyonrails.org/v3.2.1/classes/ActiveResource/CustomMethods.html#method-c-get
Can I not make it work some other way:
I really need this integration to work properly. I will be really thankful if someone helps.

How do I solve NoMethodError with google_drive gem?

Im trying to create an web app that reads from a spreadsheet in my google drive. But when Im done with the Oauth2 procedure and wants to list the files I get this Error:
NoMethodError: undefined method `drive' for nil:NilClass
from /Users/administrator/.rvm/gems/ruby-2.2.0/gems/google_drive-1.0.0/lib/google_drive/session.rb:101:in `drive'
from /Users/administrator/.rvm/gems/ruby-2.2.0/gems/google_drive-1.0.0/lib/google_drive/session.rb:149:in `file_by_id'
from /Users/administrator/.rvm/gems/ruby-2.2.0/gems/google_drive-1.0.0/lib/google_drive/session.rb:186:in `spreadsheet_by_key'
from (irb):21
from /Users/administrator/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
Im using Rails 4.2.0 with ruby 2.2.0
client_or_access_token argument is nil. Look at this code.

FriendlyId: undefined method `use_slug?' for nil:NilClass

I am creating a new environment besides production. I copied all the configurations from my production environment, changing what needed to be changed.
As it is the servers do start, but when I do a query I get this exception:
NoMethodError (undefined method `use_slug?' for nil:NilClass):
vendor/gems/friendly_id-2.3.4/lib/friendly_id/active_record2/finders.rb:65:in `slugged?'
vendor/gems/friendly_id-2.3.4/lib/friendly_id/active_record2/finders.rb:43:in `finder_class'
vendor/gems/friendly_id-2.3.4/lib/friendly_id/active_record2/finders.rb:37:in `finder'
vendor/gems/friendly_id-2.3.4/lib/friendly_id/active_record2/finders.rb:32:in `method_missing'
vendor/gems/friendly_id-2.3.4/lib/friendly_id/active_record2/slugged_model.rb:149:in `find_one'
app/controllers/home_controller.rb:5:in `index'
The line in question does this:
#page = Page.find("home")
I am using FriendlyId 2.3.4, and Rails 2.3.4. The code is the same for the production environment, and it's working just fine there, so I'm not really sure on what's going on here...I could see that the line where the exception gets raised does
friendly_id_config.use_slug?
so for a reason I'm not aware of friendly_id_config is nil.
Thanks for any guidance on this problem
I found a workaround to this issue by loading the server using the production environment.
I was trying to use a 'preprod environment, and somehow FriendlyId didn't like that strange environment.
Load the app using RAILS_ENV=production and it worked fine.
Not a solution, but at least could move on...

Resources