Skip to content

donkirkby/active-sinatra

 
 

Repository files navigation

active_sinatra

Demonstrates Sinatra web framework with ActiveRecord, including test fixtures

To set up the development database:

rake db:migrate
rake db:fixtures:load

To run the web server:

ruby app.rb

Then hit the server in your browser at these addresses:

To set up the test database:

rake db:test:prepare

To run the tests:

rake

To run the app in a console so you can inspect records or create new ones:

$ irb -r ./app.rb 
> Blog.find_by_name("Jimmy's Jottings").tagline
# => SQL log: SELECT "blogs".* FROM "blogs" WHERE "blogs"."name" = 'Jimmy''s Jottings' LIMIT 1
# => "Stuff Jimmy says" 
> Blog.create(:name => "Rob Rants")
# => SQL log: begin transaction
# => SQL log: INSERT INTO "blogs" ("name") VALUES (?)  [["name", "Rob Rants"]]
# => SQL log: commit transaction
# => #<Blog id: 705406077, name: "Rob Rants", tagline: nil> 
> 

About

Sandbox project for ActiveRecord and Sinatra web server, including test fixtures

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •