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.

Associations with more than one add-link (initialization model) #269

Open
@carlosgarciaq

Description

@carlosgarciaq

Hey, thank you very much for developing this wonderful gem! It's done my life easier.
I'm using it in my project for 2 of my forms and in one I'm finding that having two types of add-links (with different model_object) could be useful. It's a situation similar to this:

<%= nested_form_for @receipt do |f| %>
  ...
  <%= f.link_to_add "Add a good", :products, :model_object => Product.new(:kind => 'good') %>
  <%= f.link_to_add "Add a service", :products, :model_object => Product.new(:kind => 'service') %>
<% end %>

I think right now this is not supported, only one blueprint is created and both links would insert a product of type 'good'.

Do you think it could be modified easily to do it? Do you see any drawbacks? Manipulating the code in your Railscasts nr. 197 (nested model form pt. 2) this is pretty easy but there are no blueprints there.

This could also help to work with polymorphic associations. Would the gem work with polymorphic associations, btw?

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