Open jonuts opened 8 years ago
Thanks for the contribution, I've got a question.
What if your app itself stored a configuration value to pass as options to paginate
rather than modifying a property on CleanPagination
? This eigenclass stuff and running setup
in order to change a value seems potentially confusing vs having the app explicitly pass an options argument. Can you share more about how it simplifies your application code?
Really I just wanted a way to override the invalid range message. I couldn't think of a better way to do it. If you have suggestions I'm all ears
And then once I pulled out the message variable into the config, I figured the other values should come along as well
Also, this doesn't change the fact that you can still send in options directly to the paginate
method. It's a common pattern for rails plugins to take advantage of a setup-type initializer. I don't see the downside personally - more options is (usually) a good thing :)
Anyway, all I wanted to do was make the invalid range message changeable. If you would rather have that sent in the options hash directly to the paginate
method that would be fine by me. My current use case has dozens of different paginated actions. I could just as easily use a stored options hash - as long as the invalid message is actually configurable. I personally prefer the initializer route, but no biggie one way or the other.
Allows accessing setup configuration from one global location (e.g. initializer). Global settings can be overridden in
paginate
call.