Skip to content

Instantly share code, notes, and snippets.

@agerwick
Created November 9, 2014 10:10
Show Gist options
  • Save agerwick/7c346b4554995c6b90cf to your computer and use it in GitHub Desktop.
Save agerwick/7c346b4554995c6b90cf to your computer and use it in GitHub Desktop.
Can't access methods within a Sinatra::Base class
$ irb
2.0.0-p353 :001 > require 'sinatra/base'
=> true
2.0.0-p353 :002 > class PlainClass
2.0.0-p353 :003?> def say_cheese
2.0.0-p353 :004?> "cheese"
2.0.0-p353 :005?> end
2.0.0-p353 :006?> end
=> nil
2.0.0-p353 :007 > class SinatraClass < Sinatra::Base
2.0.0-p353 :008?> def say_cheese
2.0.0-p353 :009?> "cheese"
2.0.0-p353 :010?> end
2.0.0-p353 :011?> end
=> nil
2.0.0-p353 :012 > PlainClass.new.say_cheese
=> "cheese"
2.0.0-p353 :013 > SinatraClass.new.say_cheese
NoMethodError: undefined method `say_cheese' for #<Sinatra::Wrapper:0x8e4061c>
from (irb):13
from /home/raw/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>'
2.0.0-p353 :014 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment