I thought about this but read about some strange behavior with class
variables in Ruby, where a class variables are shared among
subclasses?
http://www.oreillynet.com/ruby/blog/2007/01/nubygems_dont_use_class_variab_1.html
Aman Gupta
On Nov 30, 11:13 pm, Luis Lavena [EMAIL PROTECTED] wrote
and
position_scope_field if the opts[:scope] is provided, and then check
for respond_to?(:position_scope) in the rest of the code, which seems
rather messy to me.
Aman Gupta
On Dec 2, 12:35 pm, Sharon Rosner [EMAIL PROTECTED] wrote:
Plugin loading is now implemented in the trunk. Each plugin is
expected
precompiled binaries and do not require a C compiler:
http://web.mit.edu/~agp/www/parsetree-win32/
Aman Gupta
On Dec 8, 1:59 am, paulf [EMAIL PROTECTED] wrote:
I have gone back to ruby platform in my Netbeans/Windows Vista setup
and tried to run script
-
require 'rubygems
So the way to do that right now is:
dataset.update_sql(:exp = 'exp + 10'.lit)
= UPDATE table SET exp = exp + 10
But I agree that there should be a simpler way of doing this.. maybe
update can take a filter style block so update{ :exp += 10 } works?
Aman Gupta
On Dec 14, 2:45 am, Jim Morris
Well select() controls SELECT ... FROM part of the query, and filter{}
does the WHERE ... part of the query.
Aman Gupta
On Dec 17, 3:29 pm, Jim Morris [EMAIL PROTECTED] wrote:
Ooops sorry my mistake used select instead of filter, I get those
mixed up. Is there a succinct description
sequel_model` to use
Sequel::Model'
end
end
end
Aman Gupta
On Dec 30, 4:22 am, Sharon Rosner [EMAIL PROTECTED] wrote:
Of course, you'll also need to require 'sequel_model' in order to use
Sequel::Model.
sharon
--~--~-~--~~~---~--~~
You received this message
PROTECTED]
-end
- end
-end
-
Aman Gupta
On Dec 31, 1:40 am, Sharon Rosner [EMAIL PROTECTED] wrote:
On Dec 31, 8:24 am, Aman Gupta [EMAIL PROTECTED] wrote:
We need an easy way to keep application to code backwards compatible..
Hi Aman,
I've already added a stub for Sequel::Model() that auto
Currently there's only basic reflection available- you can do
DB.tables and DB[:table].columns
Aman Gupta
On Jan 14, 12:31 pm, dan yoder [EMAIL PROTECTED] wrote:
After a little more research, I am pretty sure there is no support for
schema reflection as yet.
Getting more detailed
I see where you're coming from, but the current behavior makes more
sense to me. I can write a
dataset.select(:id)
and go in later and add a = :table_id
dataset.select(:id = :table_id)
This feels more intuitive, although semantically it might not be
correct.
On Jan 15, 11:10 pm, Kanwei
specs pass, and to add some new specs for this new behavior.
Aman Gupta
2008/1/19 Inviz [EMAIL PROTECTED]:
http://p.caboo.se/141009
Here is a proof of concept that has 70% of the stated features
implemented. If you could test it, it'd be great.
On 19 янв, 20:53, Inviz [EMAIL PROTECTED
DB1 = Sequel.sqlite 'one.db'
DB2 = Sequel.sqlite 'two.db'
class ModelOnOne Sequel::Model(DB1[:table])
end
class ModelOnTwo Sequel::Model(DB2[:table])
end
Aman Gupta
On Jan 31, 3:12 am, celldee [EMAIL PROTECTED] wrote:
Hi Ivan,
Sequel is an ORM. As such, it allows you to perform various
load the
rows from the database into ruby one at a time and let you process
them. With .all, they are all loaded into an array (which is not ideal
if you're dealing with 1000s and 10s of 1000s of rows)
Aman Gupta
Of course, I can easily solve the problem by doing:
Blog::Models
JSON is probably the way to go for your clients accessing the custom
DB layer..
Check out http://code.nytimes.com/projects/dbslayer and
http://halcyon.rubyforge.org/
Aman Gupta
On Jan 31, 1:09 pm, Angel [EMAIL PROTECTED] wrote:
Look up RESTful web apps. Specifically for examples of how
FOR_UPDATE
when :share
sql FOR_SHARE
end
sql
end
def for_update
clone_merge(:lock = :update)
end
def for_share
clone_merge(:lock = :share)
end
Aman Gupta
On Sat, Feb 2, 2008 at 7:30 AM, ara.t.howard [EMAIL PROTECTED
AWESOME!
I noticed an inflector and timecalculation core-ext in the plugin
directory, aren't we using the assistance gem for those two things
now?
Aman Gupta
On Tue, Feb 5, 2008 at 5:37 PM, Florian Aßmann [EMAIL PROTECTED] wrote:
Hi there,
I just spend the last 20 hours putting
recommended instead of to use .order() which will translate to an
SQL query:
e = Entry.all.first
# same as
# e = Entry.first
e.comments.order(:created_on.ASC)
or if you really want to use sort_by, call it on an array:
e.comments.all.sort_by(:created_on)
Make sense?
Aman Gupta
it much faster and less memory
intensive for an entries table with lots of rows.
Aman Gupta
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To post to this group, send email to sequel-talk
easily build complex SQL queries that you can execute later when you
actually want the data.
Aman Gupta
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To post to this group, send email to sequel-talk
Just be careful you don't override the default filters on the model
doing this.. With trunk you can do:
searchset = Model.dataset.clone.filter{ :enabled == true }
searchset.filter!{ :extra == false } if some condition
Aman Gupta
--~--~-~--~~~---~--~~
You
Sequel model is a thin layer built on top of sequel's core datasets.
The dataset functionality in Sequel is much more mature was built
first.. Sequel::Model is a relatively new addition. It has always been
possible to use sequel datasets without touching any of the model
code.
Aman Gupta
use multiple mysql connections intelligently whenever required?
Can we set some sort of 'in use' flag on a connection, and use another
connection from the pool when the existing connection has this flag
enabled?
Aman Gupta
--~--~-~--~~~---~--~~
You received
done.
Aman Gupta
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED
Sequel has no special notion of column types, simply use the type that
your database backend supports. For example, in MySQL with a BLOB
field, I would use:
DB.create_table :test do
blob :field
end
On Feb 22, 7:21 am, smerickson [EMAIL PROTECTED] wrote:
Is it possible to store/retrieve
On Feb 19, 1:16 pm, Clifford Heath [EMAIL PROTECTED] wrote:
On 20/02/2008, at 5:51 AM, Aman Gupta wrote:
This is no longer the case.. Just use a having clause or block
Thanks for the info. I hadn't used it, but there are still comments
in the code about it (I read right through the Sequel
out the file requires statements all works well.
I am a bit mystified by the set up for associating the model with the class.
What is the meaning of DB1[:dogs] as the parameter for the Model class?
Array, hash or what?
class Dog Sequel::Model(DB1[:dogs]); end
Paul Fraser
Aman Gupta wrote
I don't quite follow what you're trying to do.. how about this?
DB[:tbl_a].join(:tbl_b, :col_b = :col_a)
On Feb 19, 5:04 pm, Mark Van De Vyver [EMAIL PROTECTED] wrote:
Hi
I'm trying to work out what would be the most succinct way in Sequel
to merge two tables on a common index that is
On Feb 22, 12:25 pm, Jim Morris [EMAIL PROTECTED] wrote:
This is excellent!
However is there a way to have this work in an alter_table block? or
is there another way to add constraints to an existing table?
Also is there any formal documentation for check? or a wiki page?
Nothing yet,
Yes, literal converts from ruby to database types.
On Sat, Feb 23, 2008 at 2:14 PM, Mark Van De Vyver [EMAIL PROTECTED] wrote:
On Sun, Feb 24, 2008 at 7:45 AM, Aman Gupta [EMAIL PROTECTED] wrote:
Sequel has no special notion of column types, simply use the type that
your database
New members are now moderated, so it shouldn't happen again.
Aman Gupta
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To post to this group, send email to sequel-talk@googlegroups.com
Dog.print
Cat.print
Animal.each_of_type do |a|
# a is a Dog/Cat object
p a
end
The Animal.each would loop over animal objects, whereas
Animal.each_of_type will loop over Dog/Cat/etc objects.
Aman Gupta
On Mar 28, 9:57 am, Xavier Lange [EMAIL PROTECTED] wrote:
That's very interesting syntax
--og--model--revisable---rb)
would be great.
Aman Gupta
On Mon, Mar 31, 2008 at 12:33 PM, Adrian Madrid [EMAIL PROTECTED] wrote:
Is anybody working on new/old plugins? By looking at the svn repo [1] there
is a nice list but, after a quick look, most of them are empty. Anybody
built one
ParseTree won't work on 1.9:
http://web.mit.edu/~agp/www/ruby-1.9/ruby2ruby.txt
Aman Gupta
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To post to this group, send email to sequel-talk
For now you can do:
DB[:table].select('COUNT(DISTINCT name)'.lit).sql
= SELECT COUNT(DISTINCT name) FROM table
What would you generate for:
DB[:table].select(:name, :age).distinct.sql
Aman Gupta
On Sun, Apr 13, 2008 at 2:08 PM, Jerry [EMAIL PROTECTED] wrote:
I am trying to count
:
DB[:animal].where{ :age 2.weeks.ago and :weight ==
(5..10).ruby }
using RubyParser, which parses a string or file into the same format
as ParseTree. But, atleast to me, this feels unnatural and is not
nearly as appealing as a real block filter.
Aman Gupta
You can try the not_naughty plugin for validations:
http://groups.google.com/group/sequel-talk/browse_frm/thread/7ca5e048f427e829/978bfc9b8b71b82d?hl=enlnk=gstq=not_naughty#978bfc9b8b71b82d
On Apr 14, 9:50 am, Uzytkownik [EMAIL PROTECTED] wrote:
May I ask is it possible to use conditional
support for it. Sequel uses ParseTree to examine the ruby
AST, which gives it full control over what SQL it can generate (the downside
to using ParseTree/block filters is that they only work on ruby 1.8).
DB[:table].where{ [1,2,3].include? :a }.sql
= SELECT * FROM table
Aman Gupta
On Sat, May
+1 for Ramaze
The Ramaze wiki has a comprehensive list of Ruby frameworks:
http://ramaze.net/#other-frameworks
On Wed, May 28, 2008 at 10:06 AM, exploid [EMAIL PROTECTED] wrote:
Ramaze += 1
--~--~-~--~~~---~--~~
You received this message because you are
You can patch sequel_core to handle the '-00-00' = nil case:
http://p.ramaze.net/1541
Aman Gupta
On Wed, Jun 4, 2008 at 7:58 AM, Jeremy Evans [EMAIL PROTECTED] wrote:
On Jun 4, 6:22 am, myobie [EMAIL PROTECTED] wrote:
I am working with a legacy mysql database that defaults dates to all
Posts for new members are moderated, so they don't show up until they are
approved. Please do not double post. The post will appear once one of the
moderators sees it.
Aman Gupta
On Thu, Jun 5, 2008 at 5:24 PM, urbanus [EMAIL PROTECTED] wrote:
Hi Jeremy,
You shouldn't send duplicate posts
Ummm is there an alternative to the .update{ } syntax? which also
seems to have been deprecated? If there is it is not documented. (and
I use it extensively in my scripts).
How do you use this? Using == for assignment feels weird:
DB[:table].update_sql{ :a == 1 and :b == 2 }
= UPDATE
DB[:table].update{ :a :a + 1 }
- UPDATE table SET a = a + 1
These work:
DB[:table].update_sql( :a = (:a+1) )
= UPDATE `table` SET `a` = (`a` + 1)
DB[:table].update_sql( :a = 'a+1'.lit )
= UPDATE `table` SET `a` = a+1
Aman
I like it.
Aman
On Mon, Sep 8, 2008 at 10:05 AM, Jeremy Evans [EMAIL PROTECTED]wrote:
I'm thinking of using the hanna RDoc template (http://github.com/
mislav/hanna http://github.com/mislav/hanna) instead of the default for
the online docs. Sinatra is
using it for their RDoc, and I like
In Eventmachine you would use EM::Deferrable for all of your Sequel
calls. EM would handle spawning any ruby threads (green threads in
MRI, native threads in JRuby). Then use #set_deferred_status in the
Deferrable to notify your business logic when the Sequel calls have
completed.
You're
The approach I use in my projects it to combine Sequel's SQL
generation with the em-mysqlasyncapi:
EventedMysql.select( User.where(:age 10).limit(10).sql ) do |rows|
rows.each do |data|
user = User.load(data)
p user.age
end
end
You may be able to make this even
dataset.select(:users.*).join(:subscriptions, :user_id = :id).where(:feed_id
= 3).distinct
= #Sequel::MySQL::Dataset: SELECT DISTINCT `users`.* FROM `users`
INNER JOIN `subscriptions` ON (`subscriptions`.`user_id` =
`users`.`id`) WHERE (`feed_id` = 3)
or
dataset.select('DISTINCT
.
Also the migrator was moved to an extension, simply require
'sequel/extensions/migration'
Aman
Thanks for the help guys...
-Steve
On Jul 2, 1:35 pm, Aman Gupta themastermi...@gmail.com wrote:
On Thu, Jul 2, 2009 at 12:08 PM, Steve Hp.wi...@gmail.com wrote:
Jeremey, thanks so much
On Fri, Jul 10, 2009 at 1:35 AM, jimehzyn...@gmail.com wrote:
Yeah, you are right. And for the record, I'm not 100% familiar with
this code, as someone else originally wrote it, and I was tasked with
fixing the database connection issue.
Here's part of the code:
# before filter
before do
On Sat, Aug 8, 2009 at 1:28 AM, Eleo sire...@gmail.com wrote:
It seems Sequel converts tinyint fields of any size to true/false.
I'm not sure but looking at various parts of the code it seems the
intention is it only do this to tinyint(1) columns, although it's
affecting my tinyint(4)
I wrote a sequel_orderable a few years ago (there's a gem on rubyforge under
the sequel project). I doubt it still works, but you could use that as a
starting point.
Aman
On Mon, Aug 17, 2009 at 11:53 AM, Clive Crous clive.cr...@gmail.com wrote:
2009/8/17 Adrian Madrid aemad...@gmail.com:
after_update hooks are only invoked when you use Model#update, not
Dataset#update. There's no way to know which model instances were affected
by a dataset update.
Aman
On Tue, Aug 25, 2009 at 4:06 PM, Tal swimming.b...@gmail.com wrote:
Subject pretty much covers it. Running this code isn't
Perhaps you can post the results of p(Marshal.dump(r)) for both cases:
with the select, and with the stored procedure.
Aman
On Fri, Sep 25, 2009 at 12:19 PM, David Jenkins djenkins...@gmail.com wrote:
Hi, John
Thanks for the suggestions. Using :holiday does the same thing, i.e., I
can't
On Mon, Oct 12, 2009 at 2:29 PM, cult hero binarypala...@gmail.com wrote:
Okay, let's say I have a model instance and I want to create a new one
from that instance. What's the best way to do this?
I tried to cheat and just change the primary key and save it again,
but that didn't work!
On Mon, Oct 12, 2009 at 2:37 PM, cult hero binarypala...@gmail.com wrote:
Hmmm... okay, now what if my primary key is autoincrementing?
new_model = MyModel.create(model.values.merge(:id = nil))
On Oct 12, 2:31 pm, Aman Gupta themastermi...@gmail.com wrote:
On Mon, Oct 12, 2009 at 2:29 PM
On Sun, Nov 15, 2009 at 1:45 PM, André Allavena
andre.allav...@gmail.com wrote:
2009/11/15 Gavin Kistner phr...@mac.com:
On Nov 15, 2009, at 3:25 AM, André Allavena wrote:
I'm doing are a little different (I often need to go down to SQL to do
things like select sum(col1 - col2) group by col
On Thu, Nov 26, 2009 at 7:17 PM, Christer Nilsson
janchrister.nils...@gmail.com wrote:
2009/11/26 Jeremy Evans jeremyeva...@gmail.com
On Nov 26, 8:04 am, Christer Nilsson janchrister.nils...@gmail.com
wrote:
I'm *very* pleased with Sequel, but have one minor question:
Is it possible to
On Thu, Dec 17, 2009 at 12:37 PM, Iñaki Baz Castillo i...@aliax.net wrote:
El Jueves, 17 de Diciembre de 2009, Iñaki Baz Castillo escribió:
El Jueves, 17 de Diciembre de 2009, Iñaki Baz Castillo escribió:
Hi, AFAIK Ruby C mysql driver is blocking so Ruby must wait until get a
response.
So
On Wed, Dec 30, 2009 at 4:56 PM, rogerdpack rogerpack2...@gmail.com wrote:
Question.
I've noticed that if I do a
Sequel.connect(sqlite://e:/tmp/allgems/allgems.db)
#Sequel::SQLite::Database: sqlite:/e/tmp/allgems/allgems.db
the drive colon is stripped off, causing it to err.
a.execute
On Sat, Jan 9, 2010 at 1:38 PM, Matt Tuzzolo tuzzolot...@gmail.com wrote:
I'm porting some code from PHP to Ruby and have decided on using
Sequel. I have a query that uses some math functions to determine a
distance...
$query = 'SELECT *, ( 3963 * ACOS( COS( RADIANS(' .$lat. ') ) * COS
(
Nate,
I'm curious if you ever ended up writing an auto-migrations extension
for sequel?
Aman
On Fri, Oct 16, 2009 at 2:47 PM, Jeremy Evans jeremyeva...@gmail.com wrote:
On Oct 16, 12:51 pm, Nate Wiger nwi...@gmail.com wrote:
I'm fine with an external extension, makes sense.
But just some
Event.set_dataset Event.dataset.order(:id)
2010/3/17 Amit Chakradeo (अमित चक्रदेव) chakra...@gmail.com:
Hi,
I think this is a simple one, but could not figure this out myself. I am
using the Sequel::Model interface. How do I specify ordering ?
class Event Sequel::Model
order :id
end
2010/3/17 Amit Chakradeo (अमित चक्रदेव) chakra...@gmail.com:
Answering my own question, but the following works:
class Event Sequel::Model
self.dataset= self.dataset.order :id
end
But it sounds awkward, there must be a better way...
self.dataset.order!(:id) might work too
--Amit
I have a list of bugs and issues, mostly with Rails3 integration, that
I've been unable to commit time to. I would love to see an official
rails3_sequel plugin that brings Sequel integration to the same level
as Datamapper and ActiveRecord.
Aman
On Tue, Apr 13, 2010 at 6:39 PM, Shawn
I use factory_girl with Sequel and it works great. I just had to apply this
simple monkey patch:
class Sequel::Model
def save!
save(:validate=false)
end
end
On Wed, Sep 8, 2010 at 10:59 AM, John Firebaugh john.fireba...@gmail.comwrote:
On Wed, Sep 8, 2010 at 9:18 AM, rohit
You can call super, or use self[:foo]=
Aman
On Monday, November 29, 2010, Lorenzo alie...@gmail.com wrote:
Hi, I'd like to filter the input of a setter, I saw model hooks but in this
case it won't fit well since the column will not be touched in most cases.
something like:
def
On Fri, Jan 7, 2011 at 2:54 AM, Roland Swingler
roland.swing...@gmail.comwrote:
This code looks like you are attempting to disconnect after the fork,
instead of before forking. Also, you don't need to call
Sequel.connect again, just DB.disconnect should be enough. But make
sure it is
::Database){ |d| d.disconnect }
or
Sequel::DATABASES.each{ |d| d.disconnect }
Aman
I'm going to try setting the read_timeout value to a higher number and
see if that has any impact, but I'm at a bit of a loss at the moment.
R
On Jan 7, 7:21 pm, Aman Gupta themastermi...@gmail.com wrote
66 matches
Mail list logo