-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError: undefined method `singularize' for nil:NilClass #1691
Comments
After some debugging locally and turning on caching I was able to reproduce On Tuesday, April 19, 2016, Lucas Hosseini notifications@github.com wrote:
-Chris Nixon |
Oh, interesting catch! cc @bf4 |
Per @beauby as of writing this (caching will be fully working in a future release), caching slows down response time. Therefore, the quickest fix for this was to disable caching altogether, which I did by removing the line module Api
module V1
class JobSerializer < ActiveModel::Serializer
# (REMOVE THIS) cache key: 'api-v1-job'
attributes :id, :job_role, :description, :perks, :job_type, :wage,
:age_requirement, :posted_on, :enabled, :application_site,
:start_timeframe, :location, :live, :highlighted, :category_list,
:latitude, :longitude
type :jobs |
I have also been experiencing some bugs with the newest changes to caching. I was caching like this:
And would get errors like this:
Backtrace
|
cc @bf4 |
@ianks re:
So, in master this is actually now the default case. see #1642 active_model_serializers/lib/active_model/serializer/caching.rb Lines 320 to 329 in 7485c84
I'm not sure where the |
@bf4 If you're delegating
So therefore |
@adaam2 Please open a new issue. I'm not sure why you're defining |
This is currently only happening in production, so I wonder if it has something to do with caching. I did try to run
Rails.cache.clear
and I touched a few records in the DB to see if that would fix the issue. I am running on Heroku withruby 2.3.0
andrails 4.2.6
API Request
/api/v1/jobs?include=business&page=1&per_page=10
Culprit
https://github.com/rails-api/active_model_serializers/blob/v0.10.0.rc5/lib/active_model/serializer/fieldset.rb#L13
My Serializer
Overridden Collection Serializer
Stacktrace
The text was updated successfully, but these errors were encountered: