You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added ruby-trello on a Rails v4.2 project (had used it without problems in others projects without rails).
To my surprise when I started trying to query anything 404 errors began:
pry(main)> Trello::Organization.find('xxx')
E, [2019-05-01T13:01:11.722604 #74796] ERROR -- : [404 GET https://api.trello.com/1/organizationes/xxx]: Cannot GET /1/organizationes/sistemasvizcay?key=xxx&token=xxx
Trello::Error: Cannot GET /1/organizationes/xxx?key=xxx&token=xxx
from /Users/pablo/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ruby-trello-2.1.0/lib/trello/client.rb:99:in `invoke_verb'
What quickly got my attention was Cannot GET /1/**organizationes**/. Clearly something was odd and after digging at the code I've found this:
def find(path, id, params = {})
response = get("/#{path.to_s.pluralize}/#{id}", params)
trello_class = class_from_path(path)
trello_class.parse response do |data|
data.client = self
end
end
Clearly the path is being pluralized via ActiveSupport.. but, what If my Rails project has spanish language inflections as is the case? This is brittle and a bad idea as it only works with the english inflections rules. Worst, It looks I cannot configure it some other way than monkey patching.
Any chance this will be fixed?
The text was updated successfully, but these errors were encountered:
vizcay
changed the title
API endopoints path must not depend on ActiveSupport pluralization as it breaks with other languages
API endopoints paths must not depend on ActiveSupport pluralization as it breaks with other languages
May 1, 2019
I've added ruby-trello on a Rails v4.2 project (had used it without problems in others projects without rails).
To my surprise when I started trying to query anything 404 errors began:
What quickly got my attention was
Cannot GET /1/**organizationes**/
. Clearly something was odd and after digging at the code I've found this:Clearly the path is being pluralized via ActiveSupport.. but, what If my Rails project has spanish language inflections as is the case? This is brittle and a bad idea as it only works with the english inflections rules. Worst, It looks I cannot configure it some other way than monkey patching.
Any chance this will be fixed?
The text was updated successfully, but these errors were encountered: