NoMethodError in AuthenticationsController#create undefined method `RandomString' for String:Class-Collection of common programming errors

I follow this tutorial for install omniauth in devise+mongoid:

https://github.com/fertapric/rails3-mongoid-devise-omniauth/wiki/OmniAuth-Installation-Tutorial

I have devise 1.4.5 + omniauth 0.3.0 + rails 3.1.0.

I have in my devise.rb the next information:

config.omniauth :facebook, 'My_CONSUMER_KEY', 'MY_CONSUMER_SECRET', :scope => 'user_hometown, user_about_me, email'

In the tutorial, this configuration have that create a initializers/omniauth.rb file.

When I come back of facebook callback I catch this error:

NoMethodError in AuthenticationsController#create

undefined method `RandomString' for String:Class

app/models/user.rb:39:in `apply_trusted_services'
app/models/user.rb:23:in `apply_omniauth'
app/controllers/authentications_controller.rb:33:in `create_new_omniauth_user'
app/controllers/authentications_controller.rb:16:in `create'

I have create too a file in lib/string_extensions.rb with this code:

module StringExtensions
  def self.included(base) 
    String.extend StringExtensions::ClassMethods
  end
  module ClassMethods
    RAND_CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789"
    def RandomString(len)
      rand_max = RAND_CHARS.size
      ret = ""
      len.times{ ret

Originally posted 2013-11-09 23:18:36.