From b4f6665230ae0176a4827097f8e5727c34b225f4 Mon Sep 17 00:00:00 2001 From: Ben Koshy Date: Mon, 23 Dec 2019 09:38:14 +1100 Subject: [PATCH] Add: Hello world example instructions to set up a simple scaffold Hopefully these instructions will help clarify things for new users. Given rails + ActiveRecord works out of the box, new users like myself might struggle for 30+ minutes to get a simple scaffold working, From stack overflow, it looks like I wasn't the only one. This PR helps to remedy this shortcoming. This is placed in the README.md as per instructions in #176 . I hope this helps. Ben --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 2852f2b..57a4e5e 100644 --- a/README.md +++ b/README.md @@ -344,6 +344,24 @@ rake db:sessions:clear # Delete all sessions from the database rake db:sessions:trim[threshold] # Delete all sessions older than `threshold` days (default to 30 days, eg: rake db:session:trim[10]) ``` + +Getting started: A Rails Hello World Walk-through +============================= + +1. Follow the setup instructions noted above in this guide. +2. Let's create some 'organisations'. Run a `rails scaffold: rails g Organisation registration_no name` +3. Run `rake db:create` +4. Run `rake db:migrate` +5. Go to your models/organisation.rb file add add in plugins to make it work, just like if you had used ActiveRecord: + +```ruby +class Organisation < Sequel::Model + Sequel::Model.plugin :active_model ## <=== Add in that magical line. There are other plugins you can add, pertaining to validations etc. +end +``` +6. Run `rails s` and type in the following URL: localhost:3000/organisations - you should be able to add/view/edit/create organisations now. + + Note on Patches/Pull Requests =============================