Re: How do I reload a model subfile?

24 views
Skip to first unread message

Kashyap Kondamudi

unread,
Aug 9, 2012, 1:51:10 AM8/9/12
to sina...@googlegroups.com
You can reload model files by using the 'also_reload' method provided in Sinatra::Reloader module.

Add a line:

also_reload 'path/to/other/file'

after the register Sinatra::Reloader line in the configure block

configure :development do
  register Sinatra::Reloader
  also_reload 'path/to/sub-model'
  dont_reload 'path/to/bad/sub-model'
end

27 July 2012 12:29 PM
Hello all,
  require "sinatra/reloader" if development?

class MyApp < Sinatra::Base
  enable :sessions #, :logging
  configure :development do
    register Sinatra::Reloader
  end
end

#for this, I can reload this my main app file,
but for subfile resides in sub lib dir,

#in header require
$: << File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
require 'client/phone'
$phone = Phone.new

#in app
get '/phone' do
     $phone.foo
    #params.inspect
    #Luna::Session.new
    #"abc"
  end
I know there's no proper for 'requiring the file',
I know I must be missing something here.
but how do I reload those files too?
Thanks.
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sinatrarb/-/JaWaLD41uMUJ.
To post to this group, send email to sina...@googlegroups.com.
To unsubscribe from this group, send email to sinatrarb+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.
Reply all
Reply to author
Forward
0 new messages