sinatra-formkeeper icon indicating copy to clipboard operation
sinatra-formkeeper copied to clipboard

Can't run the example!

Open robsalasco opened this issue 11 years ago • 2 comments

Hi! I'm having this problem

/Users/rob/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sinatra-formkeeper-0.0.7/lib/sinatra/formkeeper.rb:127:in `<module:Sinatra>': undefined method `register' for Sinatra:Module (NoMethodError)
    from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sinatra-formkeeper-0.0.7/lib/sinatra/formkeeper.rb:26:in `<top (required)>'
    from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
    from form.rb:1:in `<main>'

Can you help me please? Thank you.

robsalasco avatar Feb 10 '14 04:02 robsalasco

Hi,

Thank you for your report. But it's not enough to dig into the problem.

Did you make sure to write

require 'sinatra' or require 'sinatra/base'

before require 'sinatra/formkeeper'

On Mon, Feb 10, 2014 at 1:50 PM, robsalasco [email protected]:

Hi! I'm having this problem

''' /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sinatra-formkeeper-0.0.7/lib/sinatra/formkeeper.rb:127:in module:Sinatra': undefined methodregister' for Sinatra:Module (NoMethodError) from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sinatra-formkeeper-0.0.7/lib/sinatra/formkeeper.rb:26:in <top (required)>' from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in require' from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in rescue in require' from /Users/x0r/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in require' from form.rb:1:in `' '''

Can you help me please? Thank you.

Reply to this email directly or view it on GitHubhttps://github.com/lyokato/sinatra-formkeeper/issues/2 .


Lyo Kato [email protected]

lyokato avatar Feb 10 '14 07:02 lyokato

I've just seen some similar behaviour, but in this case the problem was simply that adding sinatra-formkeeper to the project's Gemfile was enough to load the extension before sinatra/base was required.

Changing the Gemfile to this (and then requiring sinatra/formkeeper manually in the code) sorted it:

gem "sinatra-formkeeper", require: nil

gma avatar May 27 '14 21:05 gma