Skip to content

Rails g scaffold for module resource generates wrong directory in jbuilder templates. #379

Open
@rafaelfranca

Description

@rafaelfranca

From @jung-hunsoo on January 30, 2017 10:9

Steps to reproduce

$ rails g scaffold guest/category title description

Expected behavior

While many new files being generated, three jbuilder templates are expected to be created like this:

  • _guest_category.json.jbuilder
    json.extract! guest_category, :id, :title, :description, :created_at, :updated_at
    json.url guest_category_url(guest_category, format: :json)

  • index.json.jbuilder
    json.array! @guest_categories, partial: 'guest/categories/guest_category', as: :guest_category

  • show.json.jbuilder
    json.partial! "guest/categories/guest_category", guest_category: @guest_category

Actual behavior

The two jbuilder templates for index and show have inexistent directory which the module namespace isn't applied.

  • _guest_category.json.jbuilder
    json.extract! guest_category, :id, :title, :description, :created_at, :updated_at
    json.url guest_category_url(guest_category, format: :json)

  • index.json.jbuilder
    json.array! @guest_categories, partial: 'guest_categories/guest_category', as: :guest_category

  • show.json.jbuilder
    json.partial! "guest_categories/guest_category", guest_category: @guest_category

System configuration

Rails version: 5.0.1

Ruby version: 2.3.3

Copied from original issue: rails/rails#27845

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions