views:

50

answers:

2

Hi, I am currently doing small pet project web programming stuff using ruby. I am new to web programming, MVC, ORM and so on, so lots of hurdles here.

Anyway, I have difficulties using sequel as ORM.
I already have a postgres db running (created without using sequel whatsoever, just used plain postgresql command) but don't know where/how to start using sequel as ORM.
I know how to connect to postgresql db using sequel and then what??

It's been a frustrating time for a while as I am stuck in this problem. The doc in the website is kinda overwhelming for me. IRC channel no answers..
My first goal is to make a simple ruby script that able to update a table in postgresql from csv file using sequel as a ORM.
Desperately need some enlightenment.

+1  A: 

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. http://pragprog.com/titles/rails4/agile-web-development-with-rails

Derick Bailey
I don't think it's very useful for Sequel?
Mladen Jablanović
Rails is still very opinionated about how to do things, so I think a more-gentle approach to learning Ruby, MVC, ORM would be Sinatra as it works very well for simple projects, integrates easily with Sequel, ActiveRecord, DataMapper or even DBI.
Greg
mladen - you're right. i wasn't paying close enough attention when i replied. i think Greg's answer is probably more appropriate.
Derick Bailey
I do agree that "Agile Web Development With Rails" is a good book once someone has learned the Ruby/MVC/ORM basics. Rails is a great platform and knowledge of how it works is a good job skill.
Greg
+3  A: 

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. Beyond the README there's http://sequel.rubyforge.org/documentation.html. Sequel 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.

Greg
Yes, I think that the key thing about Sequel (especially compared to other ORMs) is that it's really about datasets, and mapping tables to model classes is strictly optional.
Stuart Ellis
Yes, most definitely I like the fact that table to model mapping is optional. It really speeds up development for quick 'n dirty tools.
Greg