cattr_accessor outside of rails

前端 未结 2 818
北恋
北恋 2021-01-13 08:19

I\'m trying to use the google_search ruby library (code follows) but it complains that \'cattr_accessor is an undefined method\' - any ideas why this might be o

2条回答
  •  自闭症患者
    2021-01-13 09:05

    You can get this functionality by including the Ruby Facets gem. Reference the source here:

    https://github.com/rubyworks/facets/blob/master/lib/core/facets/cattr.rb

    You generally don't need to require all code from the gem. You can selectively require what you want. There are quite a few useful extensions in the gem though.

提交回复
热议问题