Re: Is it possible to get primary key on the fly?

2017-01-13 Thread Jeremy Evans
On Friday, January 13, 2017 at 5:10:23 PM UTC-8, Septian Hari wrote: > > Hello guys, > as the title says, i wanted to get primary key from a table. > Is there any method from sequel that provide that? > You can get that information using Database#schema, and looking for :primary_key entries

Is it possible to get primary key on the fly?

2017-01-13 Thread Septian Hari
Hello guys, as the title says, i wanted to get primary key from a table. Is there any method from sequel that provide that? -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: add_* method name derivation is causing me havoc

2017-01-13 Thread Jon Gross
Aha. Of course! Thank you so much I should have kept digging. Cheers On Thu, Jan 12, 2017 at 10:08 PM Jeremy Evans wrote: > On Thursday, January 12, 2017 at 9:51:26 PM UTC-8, Jon Gross wrote: > > First of all, I've done lots of Ruby, but this is my first project with >

Re: Using an SQL function as a default value in create_table

2017-01-13 Thread Jeremy Evans
On Friday, January 13, 2017 at 6:50:04 AM UTC-8, George Millo wrote: > > I'm using postgresql, and I want to set the default value of a timestamp > column to the current time. If I was writing pure PSQL with a CREATE TABLE > I'd do something like column_name TIMESTAMP DEFAULT clock_timestamp().

Re: Object freeze and data reading

2017-01-13 Thread Jeremy Evans
On Friday, January 13, 2017 at 2:20:46 AM UTC-8, David Espada wrote: > > Hi all. > > I have a little problem reading data objects inside a frozen object. If I > have a one_to_many relationship between Foo and Bar models, this code fails > without a good reason (IMHO): > > foo.freeze >

Using an SQL function as a default value in create_table

2017-01-13 Thread George Millo
I'm using postgresql, and I want to set the default value of a timestamp column to the current time. If I was writing pure PSQL with a CREATE TABLE I'd do something like column_name TIMESTAMP DEFAULT clock_timestamp(). Is there a way I can create a table like this without having to write too

Object freeze and data reading

2017-01-13 Thread David Espada
Hi all. I have a little problem reading data objects inside a frozen object. If I have a one_to_many relationship between Foo and Bar models, this code fails without a good reason (IMHO): foo.freeze foo.bars Problem is in line lib/sequel/model/associations.rb:1791 of Sequel code. Any clue