Teach jsonapi:resource generator to respect namespaced models and controllers#141
Open
alsemyonov wants to merge 10 commits intojsonapi-suite:masterfrom
Open
Teach jsonapi:resource generator to respect namespaced models and controllers#141alsemyonov wants to merge 10 commits intojsonapi-suite:masterfrom
jsonapi:resource generator to respect namespaced models and controllers#141alsemyonov wants to merge 10 commits intojsonapi-suite:masterfrom
Conversation
jsonapi:resource generator respect namespaces models and controllersjsonapi:resource generator to respect namespaced models and controllers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the issue with namespaced models.
rails generate jsonapi:resource Blog::PostBefore
app/serializables/blog/serializable_post.rbfile withSerializableBlog::Postclass inside (💣 breaks autoloading).app/controllers/blog/posts_controller.rb,but
config/routes.rbincludes:rails generate factory_bot:model Blog::Postis called:blog_post,but API request specs try to
create(:post)(💣 Factory not registered! )spec/api/v1/posts/blog/{create,destroy,index,show,update}_spec.rb(←posts/blog? what is that?)jsonapi_{get,delete,post,put} '/api/v1/posts'(💣 which nothing can handle)After:
app/serializables/blog/serializable_post.rbfile withBlog::SerializablePostclass inside.app/controllers/blog/posts_controller.rb,and
config/routes.rbincludesrails generate factory_bot:model Blog::Postis called:blog_post,and API requests specs try to
create(:blog_post)spec/api/v1/blog/posts/{create,destroy,index,show,update}_spec.rb(←blog/posts, according to generated controller)jsonapi_{get,delete,post,put} '/api/v1/blog/posts'(which is handled by generatedBlog::PostsController