An open API service indexing awesome lists of open source software.

https://github.com/donkirkby/active-sinatra

Sandbox project for ActiveRecord and Sinatra web server, including test fixtures
https://github.com/donkirkby/active-sinatra

activerecord oracle ruby sandbox sinatra

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# 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:

* [http://localhost:4567](http://localhost:4567)
* [http://localhost:4567/blogs](http://localhost:4567/blogs)
* [http://localhost:4567/blogs/413685242](http://localhost:4567/blogs/413685242)
* [http://localhost:4567/blogs/413685242/posts](http://localhost:4567/blogs/413685242/posts)
* [http://localhost:4567/posts/807550412](http://localhost:4567/posts/807550412)

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
# => #
>