hashrocket / decent_exposure

A helper for creating declarative interfaces in controllers
MIT License
1.81k stars 107 forks source link

Work along with FriendlyID5 out of the box #128

Closed johannesluedke closed 9 years ago

johannesluedke commented 9 years ago

When using FriendlyID5 (without deprecated finders and their monkey-patching), for a slug stored in params[:id], at the moment it's necessary to use

expose(:object) { params[:id] ? Model.friendly.find(params[:id]) : Model.new(model_params) }

which takes away a lot of the niceness of decent_exposure. It would be nice if the .friendly.find style could be configured out of the box along the lines of

 expose(:object, config: :friendly) 

or similar

mattpolito commented 9 years ago

Thanks @johannesluedke for your input. That seems like a pretty specific request but we will definitely consider this use case when defining our feature requests for v3.0.

johannesluedke commented 9 years ago

To make it less specific - it would be nice to be able to set .friendly.find as the finder option like so

  expose(:article, finder: < .friendly.find > )

Currently a symbol is passed to the finder option and I am not sure how a chained method called can be mapped to a symbol properly - but this would solve as well and be less specific

mattpolito commented 9 years ago

we will definitely have that

johannesluedke commented 9 years ago

Cool :) Thanks for your contributions (y)