Skip to content

Commit

Permalink
Added sinatra instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
colszowka committed Feb 20, 2009
1 parent 1bd90f7 commit 785a158
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ h2. Features
* RACK_ENV-aware and thus ready to use with multiple environments with Sinatra or any other Rack-backed webapp framework
* Logging for ActiveRecord

h2. Usage
h2. Setup

# Get "tarball":http://github.com/colszowka/activerecord-skeleton/tarball/master
# Extract tarball to desired folder
Expand All @@ -21,6 +21,20 @@ h2. Usage
# Create a model in lib/user.rb: <code>class User < ActiveRecord::Base; end;</code>
# Add application code in project root directory and <code>require 'init'</code> in it

h2. Usage with "Sinatra":http://www.github.com/sinatra/sinatra

In your application file (say <code>app.rb</code> sitting in the project root), simply add <code>require 'init'</code> <b>after</b> <code>require 'sinatra'</code>.

A basic sinatra app.rb might look like following (assuming you've got the user model setup and migrated)
<code>
require 'sinatra'
require 'init'

get '/' do
User.all.map {|u| u.name}.to_sentence
end
</code>

h2. Copyright

activerecord-skeleton is Copyright &copy; 2009 Christoph Olszowka, It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

0 comments on commit 785a158

Please sign in to comment.