Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Mismatched routing in scaffold #159

Open
@reagleton

Description

@reagleton

I used the nifty:scaffold to generate a scaffold for my pre-existing Media model.

The scaffold generated the following paths (amongst others) as part of the scaffold,

  • edit_media_path
  • new_media_path

This caused a NameError and when I checked rake routes, I discovered that the RESTful resource routing had defined them as,

  • edit_medium_path
  • new_medium_path

From my explorations, it seems that Rails routing creates these paths based on the classify method but that the Nifty scaffolding uses something else.

This may be a problem in Rails itself too because the form_for method does not correctly identify the appropriate paths either when using the short form (as defined in http://guides.rubyonrails.org/form_helpers.html#relying-on-record-identification), but I would appreciate it if other more knowledgeable people could confirm that this is indeed a real issue (and that I'm not just forgetting something)

I ended up not only having to modify the paths of the scaffold but also have to add conditional code to the forms to assign the appropriate path and method.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions