-
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
ApplicationSerializer not picked up by generator #1890
Comments
@ganlron which AMS version? I'm unfamiliar with |
Oh, ha, it's our own option
Looks like it's because the generator checks if the ApplicationSerializer is defined, and it may not have been loaded yet? So, logic there could be better? |
LOL ya, was your option :) I was trying to figure out how it would be loaded in the generator flow. Maybe the flow has changed for Rails 5, as simply creating an Application Serializer doesn't seem to cut it anymore. |
I'm pretty sure you could fix this by changing the def parent_class_name
options[:parent] or ::ApplicationSerializer.name
rescue NameError
'ActiveModel::Serializer'
end |
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
ApplicationSerializer could exist, but not be loaded. So, we check existence by looking at the filesystem instead of defined?. Fixes rails-api#1890
Expected behavior vs actual behaviour
I've created an ApplicationSerializer in app/serializers/application_serializer.rb and was expecting rails g serializer foo to inherit from this, but it still defaults to ActiveModel::Serializer.
I can get around this by passing ApplicationSerializer with --parent and it works, but wasn't expected behaviour
Environment
Rails 5.0.0.1
ruby 2.3.1p112
The text was updated successfully, but these errors were encountered: