Sequel ORM usage
I am currently doing a small pet project involving web programming stuff using Ru开发者_开发技巧by. I am new to web programming, MVC, ORM and so on, so lots of hurdles here.
Anyway, I have difficulties using Sequel as the ORM.
I already have a PostgreSQL database running (created without using Sequel whatsoever, I just used a plain PostgreSQL command), but I don't know where/how to start using Sequel as the ORM.
I know how to connect to a PostgreSQL database using Sequel and then what?
It's been a frustrating time for a while as I am stuck in this problem. The documentation in the website is kind of overwhelming for me. Trying an IRC channel resulted in no answers..
My first goal is to make a simple Ruby script that is able to update a table in PostgreSQL from a CSV file using Sequel as a ORM.
I desperately need some enlightenment.
I'd recommend Sinatra, Sequel and HAML as a MVC combo.
It's easy to get Sinatra up and running.
Use HAML or Erubis for the views; I personally prefer HAML because it's very succinct.
Sequel is nicely documented and is my personal preference for an ORM because it's flexible and lets me build classes that map directly to the database schema and give me full relationships, or use the datasets for quick and easy database access.
Oh, regarding using Sequel to update data in a Postgres table - it's easy. Show what code you've got already and I'm sure we can get you pointed in the right direction.
The best way to learn everything you need is with a good book that walks through the introduction of all these things. I highly recommend "Agile Web Development With Rails". It will teach you everything you need to know.
精彩评论