I'm am working with datamapper in a classic Sinatra app and my file is getting to big to manage and troubleshoot. I was wondering if it would be possible to put my datamapper model definitions into one file the processing algorithms into another file and my call them both into my main index.rb. I've only been working with sinatra for a month or so but them must be a way to modularize your app into smaller maintainable files the classic way. right?
Here is the gist of what I'm trying to do:
- Load sinatra app (index.rb).
- The app loads the datamaper definitions (defineDB.rb).
- The app loads the CRUD algorithms (proceesDB.rb).
So if a put request is received:
put '/protected/person/:id' do
@p = Person.first(:id => params[:id])
p.update(
#update table row
)
end