开发者

Problems with gem

I have a gem I would like to make. It is suppose to make it easier to make a dynamic form in a controller by allowing you to do this:

@actionMenuItems = ActionMenuItem.new("Link Name", url_path)

and I have this in my gem in lib/dynamic_form.rb:

 module dynamicMenu

 class ActionMenuItem
   attr_accessor :name, :link

   def initialize(name, link)
     @name = name
     @link = link
  end

 end

end

However when I try to add this gem into my application I get:

开发者_如何转开发

uninitialized constant UsersController::ActionMenuItem

this is the first gem I have ever made so help would be appreciated.


I believe the problem is with namespacing. The ActionMenuItem is contained within dynamicMenu module, so the proper way to refer to it would be dynamicMenu::ActionMenuItem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜