Coder Social home page Coder Social logo

yaitaimo / sinatra-activerecord-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from belinskidima/sinatra-activerecord-example

0.0 2.0 0.0 181 KB

Small Sinatra app uses "sinatra-activerecord" and "sqlite". Also, "tux" is available for interactive Sinatra shell

Ruby 57.22% CSS 2.22% HTML 40.56%

sinatra-activerecord-example's Introduction

Sinatra + Activerecord Example

Here is a small example of sqlite database using with sinatra-activerecord. Also, tux gem for interactive Sinatra shell!

Setup

First, install the gems:

bundle install --path=vendor/bundle --without production

After, create the db rake db:migrate then you can add sample seed data with rake db:seed. This will read data from db/seeds.rb and fill the db.

You can rake to start development server. Also, use rake tux for interactive shell. Like;

Post.all
Post.find_by_id(1)

Enjoy!

Deploy to Heroku

First you need to create Heroku app: heroku apps:create then you need to push it to Heroku : git push heroku master. After that you need to run migration : heroku run rake db:migrate after that you need to inject seed data : heroku run rake db:seed.

then heroku open to launch you site!

You can set Time Zone information via;

heroku config:add TZ="Europe/Istanbul # for İstanbul. After this, please restart your app : heroku ps:restart web and re-run seeding heroku run rake db:seed

My example app : http://still-bayou-4809.herokuapp.com

Updates

2014-07-31

  • Rack CRSF protection added

2014-07-30

  • Add/Edit and Delete post options added
  • Required fields and validation added

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.