开发者

Ruby Module name conflict

开发者 https://www.devze.com 2023-03-17 16:44 出处:网络
I\'ve grouped a set of controllers in a folder called: \"Foursquare\", the class declaration with the module name looks like this: Foursquare::BadgesController. Inside this controllers I want to call

I've grouped a set of controllers in a folder called: "Foursquare", the class declaration with the module name looks like this: Foursquare::BadgesController. Inside this controllers I want to call methods from the Foursquare gem that also has the Foursquare Module:

class Foursquare::BadgesController < ApplicationController
   def search
     user = Foursquare::User.new(session[:access_token])
   end
end

So it doesn't work.

Is there any option bes开发者_StackOverflowides renaming the controller's Module name ?


Why doesn't it work? Nothing says you can't insert your own classes into the Foursquare module space. Not that it's necessarily a good idea, but the language allows it no problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消