Closed balajivenkatesh closed 4 years ago
Hi @balajivenkatesh, the public method is defined here:
https://github.com/mixonic/ranked-model/blob/master/lib/ranked-model.rb#L64
Are you calling this on the base model object?
@brendon thanks for the quick response!
My gem version was 0.4.2 and the latest is 0.4.6
I updated with bundle update ranked-model
and the method is available now.
Closing issue.
Oh sorry, I see what you mean. Looks like we may have forgot to declare that method public :) Would you like to do a PR fixing this, along with a test for it?
I just see your new message now, are you sure it's working? It looks like we're defining it in the private area still.
I'm guessing this line is probably not really necessary anymore? https://github.com/mixonic/ranked-model/blob/master/lib/ranked-model.rb#L68
Yes, that line might not be necessary anymore - define_method doesn't explicitly say it but it might be the case.
https://stackoverflow.com/questions/3782026/how-do-i-dynamically-define-a-method-as-private says how private
dynamic methods can be specified
Thanks @balajivenkatesh
According to the Readme,
But invoking {column_name}_rank causes NoMethodError . Though {column_name}_position works. Is that expected?
Looking at https://github.com/mixonic/ranked-model/commit/200ebe2e5cf283219022688f733d78c79df2fa71#diff-0101443cdd715634c1e9e26e4460f27662129d8d8afbc994447f3d5ffbbde998R68 seems to suggest the
{column_name}_rank
may not be public?[Edit] My gem version was 0.4.2 and the latest is 0.4.6 I updated with
bundle update ranked-model
and this was fixed.