-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Integrations, Rails
-
None
Background
Simple Form is a widely-used gem with over 8000 stars on Github. The `f.association` syntax is broken Mongoid, which works with ActiveRecord. Refer to these issues:
- https://github.com/heartcombo/simple_form/issues/1609
- https://github.com/heartcombo/simple_form/issues/268
Why?
"Making Mongoid easier for new users" appears to be a topic the MongoDB team is interested in. Fixing issues which new users are likely to encounter when making new apps will increase user satisfaction.
Possible Fix
I was able to fix the #1609 with the following Monkey patch, This could be added to Mongoid's codebase with a @note comment on the methods to explain why they are needed. Alternatively, we could raise a patch to SimpleForm itself.
module Mongoid module Association module Relatable def macro '' end end module Referenced class BelongsTo def macro :belongs_to end end class EmbeddedIn def macro :embedded_in end end class EmbedsOne def macro :embeds_one end end class EmbedsMany def macro :embeds_many end end class HasAndBelongsToMany def macro :has_and_belongs_to_many end end class HasMany def macro :has_many end end class HasOne def macro :has_one end end end end end