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
- Host: GitHub
- URL: https://github.com/donkirkby/active-sinatra
- Owner: donkirkby
- License: mit
- Created: 2016-01-27T00:05:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-11T03:33:33.000Z (over 1 year ago)
- Last Synced: 2025-03-31T07:21:54.849Z (about 1 year ago)
- Topics: activerecord, oracle, ruby, sandbox, sinatra
- Language: Ruby
- Homepage:
- Size: 47.9 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
# => #
>