Skip to content

Using exhibit in path helpers or form builder creates wrong url with extra parameters #8

Closed
@mattvanhorn

Description

@mattvanhorn

when both product and order are exhibits

simple_form_for [product, order] 

generates

<form accept-charset="UTF-8" action="/products/2/orders?product_id=2" class="simple_form new_order" id="new_order" method="post" novalidate="novalidate">

I don't know why it does that, but having the product_id twice means I can't find the product from the params (since params[:product_id] == ['2','2']

new_product_order_path(product)

behaves the same way.

new_product_order_path(product.to_model)

generates the right URL, but seems to go against the simple delegation pattern - why do I have to remember where I need a model and where I need an exhibit? It's like a duck with a speech impediment. ;-)

This feels like it is probably Rails doing some kind of type-checking, but so far I can't confirm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions