syedmusamah / grape_on_rails_routes

See Rails-like routes for Grape API's mounted on Rails
MIT License
91 stars 14 forks source link

uniq should take into account the request method too. #2

Closed texpert closed 8 years ago

texpert commented 8 years ago

Otherwise, rake routes is showing incomplete list of routes.

syedmusamah commented 8 years ago

Thank you for identifying a critical bug and fixing it @texpert!

I see 1 small issue, route.route_method is nil for the grape 404 catchall route. This causes the rake task to throw: TypeError: no implicit conversion of nil into String

Do you mind throwing in a .to_s ?

routes = grape_klasses.flat_map(&:routes).uniq { |r| r.route_path + r.route_method.to_s }

texpert commented 8 years ago

Of course, @syedmusamah here it went.

syedmusamah commented 8 years ago

Merged; 0.2.0 released