Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making <select-many> polymorphic #136

Open
stevemadere opened this issue Jan 3, 2015 · 1 comment
Open

Making <select-many> polymorphic #136

stevemadere opened this issue Jan 3, 2015 · 1 comment

Comments

@stevemadere
Copy link

Since <select-one> and<select-many> are used in auto-generated inline forms, it would
probably be best to make them polymorphic so that the user has the option
to customize the type of input used in an inline form.

Example scenario:


Imagine we have a model called Category, one called Product, one called Vendor.

class Category
  ...
  has_many :product_categories
  ...
end

class ProductCategory
  ...
  belongs_to :product
  belongs_to :category
  ...
end

class Product 
  ...
  belongs_to: vendor
  has_many :product_categories
  has_many :categories through: :product_categories, accessible:true
  ...
end

class Vendor
  ...
  has_many :products
  ...
end

The default edit/create form for Vendor includes an in-line creation
subform to add a Product to products and that subform *always* has
a <select-many> for the categories field but I want it to have a <check-many>.

As far as I can tell, the subform for adding to products while editing a Vendor
*does not employ any identifiable dryml tag for the Product subform*.

Because of that,  I cannot customize the choice of the editor tag used 
for categories in the Product subform.

My hope is to change the definition of <select-many>
(polymorphically  just for Category) so that it
actually invokes <check-many>.

e.g.
<def tag="select-many" for="Category>
  <check-many options="&Category.all">
</def>

A similar scenario arises with select-one when the relationships is belongs_to

@iox
Copy link
Member

iox commented Jan 5, 2015

Great issue report, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants