Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
Created April 28, 2010 10:03
Show Gist options
  • Save WaYdotNET/381955 to your computer and use it in GitHub Desktop.
Save WaYdotNET/381955 to your computer and use it in GitHub Desktop.
class Kalifornium < Padrino::Application
register Loader
end
module Loader
def registered(app)
app.send(:include, Coder)
end
module Coder
def self.load_accessories
# variable
@sides = Side.all
@status = Status.all
@typologies = Typology.all
@toilette = Toilette.all
@beds = AdditionalBed.all
@children = Child.all
end
end
end
file in /lib
view:
NoMethodError at /rooms/new
undefined method `each' for nil:NilClass
- @sides.each do |side|
Kalifornium.controllers :rooms do
get :new do
Coder.load_accessories
@room = Room.new
@title = "ADMIN: Inserisci una nuova stanza"
render "rooms/new"
end
end
@DAddYE
Copy link

DAddYE commented Apr 28, 2010

# app.rb
MyApp < Padrino::Application
  def foo
    @a = 1
  end
end

# controllers/test.rb
MyApp.controllers :base do
  get :index, :map => "/" do
    foo
    @a.inspect
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment