Displaying 20 results from an estimated 70000 matches similar to: "How do I limit/restrict a results set?"
2008 Mar 14
2
MySQL IN clause for an array of strings
I''m trying (for the first time) to build an IN clause from an array of
strings and getting an error using MySQL as the DB...
Here''s the code I''m using to build the clause:
zips_clause = ''''
user.get_zipcodes.each {|z|
zips_clause += '','' if !zips_clause.blank?
zips_clause += ''\'''' + z +
2007 May 25
2
Sortable onChange fires for every mouse movement
Anyone found that sometime between 1.6.4 and 1.7.1 beta releases of
Scriptaculous that something has changed with the way that the
onChange is fired?
In 1.6.4 it fired once, now in 1.7.1 beta it fires everytime you move
the mouse.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs"
2008 Jan 10
2
Getting results matching with an array?
I have an array authors=[1,3,7] and I want to get all the posts that
match with any or all of these results.
something like...
posts = Post.find(:all, [:conditions => ''''author_id = ?'', authors])
of course this wont work but I need something like it that works..
thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
2007 Oct 18
9
with_scope issue
I have the following code:
class User < ActiveRecord::Base
has_many :requests do
def find_active(options = {})
with_scope :find => { :conditions => ["requests.active = ?",
true] } do
find(:all, options)
end
end
end
end
Executing user.requests.find_active results in the following SQL:
SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND
(
2007 Apr 30
2
has_many :through polymorphic
Hi All,
I have the following arrangement:
class PickAndPackRequest < ActiveRecord::Base
has_many :transactions, :as => :request
has_many :postings, :through => :transactions
end
class Transaction < ActiveRecord::Base
belongs_to :request, :polymorphic => true
has_many :postings
end
class Posting < ActiveRecord::Base
belongs_to :transaction
end
But when I ask for
2008 Jan 04
5
Confused by the unit test results.
I''m testing the relation between two of my models: MessageThread
(parent), which has_many Message (children). When I run the following
test, it gives me an error:
---------------------------------
# test with a valid message
def test_valid_message_new
thread = MessageThread.new :title => ''awesome thread''
message = thread.messages.build(:body
2008 Dec 13
3
how to do "special queries" ala The Rails Way on "associated" conditions?
I have the following in a model class:
class Game < ActiveRecord::Base
has_many :player_stats
has_many :players, :through => :player_stats
def visitor_stats
stats = []
player_stats.each do |stat|
stats << stat if stat.player.team.team_code ==
self.visiting_team_code
end
stats
end
def home_stats
stats = []
player_stats.each do |stat|
stats << stat if
2008 Sep 03
5
Eager load associations in Oracle problem with more than 1000 records
I think Rails 2.1 introduced a bug when eager loading of associations
with Oracle. In 2.1 ActiveRecord loads the included table with a big
''IN'' query: ''where association.id in (1, 2, 3, 4...)''. The problem
is that Oracle has a hard limit of 1000 values in an IN clause. I get
this error:
''OCIError: ORA-01795: maximum number of expressions in a list
2009 Feb 02
9
ActiveRecord Unexplainable SystemStackError - Only in WEBrick
This SystemStackError is driving me crazy. It only takes place when
testing with WEBrick - I can''t reproduce it with any tests. It is
caused by calling the "missing" id method (base.rb:2435) on my
ActiveRecord class.
WEBrick and my tests are running as the same user, with a `ulimit -s`
of 10240. Plus the query works sometimes so I don''t think this
matters.
2007 Sep 05
8
Hi..Guys new plugin again
Hi..
Guys new plugin again
Foreign Key Associations is a plugin that automatically creates
associations based on foreign-keys. The associations are created at
runtime-ie. as your ActiveRecord models are loaded-so they will always
be up-to-date.
For example, given a foreign-key from a customer_id column in an
orders table to an id column in a customers table, the plugin
creates:
2002 Dec 10
1
SuSE 8.1/Samba 2.2.7 - files disappear in home subdirs
Hi Everybody,
first the setup:
logon path = \\pmn90\%U\profile
logon drive = U:
logon home = \\pmn90\%U
[homes]
valid users = %S
read only = No
inherit permissions = No
security mask = 0777
directory security mask = 0777
browseable = No
This setup mounts "/home/user-xy" under letter "U:". People usually
2007 Dec 12
2
possible bug in eager loading
Hello,
@users = User.find(:all, :include => {:user_data =>
:user_data_field}, :order => "username = ''someone-oHC15RC7JGTNLxjTenLetw@public.gmane.org'' desc",
:limit => 50)
This produces:
User Load IDs For Limited Eager Loading (74.648762) SELECT * FROM
(SELECT DISTINCT ON (users.id) users.id, username AS alias_0 FROM users
LEFT OUTER JOIN
2006 Jun 18
3
Ambiguous clause error
I''m trying to query one table to ultimately display the relate info from
another table. I have 2 tables: "posts" and "numbers". I''m trying to do
a query like this:
@numbers = Number.find(:all,
:conditions => [ ''(user_id) = :id'',
{:id =>
2009 Jan 09
2
ZFS encryption?? - [Fwd: [osol-announce] SXCE Build 105 available
It was rumored that Nevada build 105 would have ZFS encrypted file
systems integrated into the main source.
In reviewing the Change logs (URL''s below) I did not see anything
mentioned that this had come to pass. Its going to be another week
before I have a chance to play with b105.
Does anyone know specifically if b105 has ZFS encryption?
Thanks,
Jerry
-------- Original Message
2002 Nov 28
1
AW: "attrib +R myowndir" fails to write-protect my own dir
>On November 28, dkrnic@t-online.de said:
>> actually a second attempt at drawing your attention to the fact
>> that compliance with M$ quirks and kinks is not something to be
>> ashamed of but rather reason to be proud.
>
>I think you'll find that the Samba team are quite familiar with this
>opinion, especially in the context of the Samba TNG fork :)
>
2005 Dec 23
2
has_many and belongs_to relationship error
Hi i am getting following error
ActiveRecord::StatementInvalid in Blog#index
Showing app/views/blog/index.rhtml where line #10 raised:
Mysql::Error: #42S22Unknown column ''posts.user_id'' in ''where clause'':
SELECT * FROM posts WHERE (posts.user_id = 4)
Extracted source (around line #10):
7: <div class="separator"> </div>
8:
2002 Nov 27
6
"attrib +R myowndir" fails to write-protect my own dir
A trivial case:
executing the following DOS command from the prompt line on a Win2K SP3:
%windir%\system32\attrib.exe +R H:\dir
can't set the R(eadonly) flag on my home dirs (2.2.7):
drwxrwsr-x 4 me users 4096 Nov 27 17:59 .
drwxr-sr-x 2 me users 4096 Nov 27 17:59 dir
-r--r--r-- 1 me users 0 Nov 27 17:59 empty.txt
drwxr-sr-x 2 me users 4096 Nov 27 17:27
2004 Aug 08
1
[fdo] Inkscape BOF @ Siggraph LOS ANGELES - MON, AUG 9, 4-5 PM
*PLEASE FORWARD*
Inkscape: An Open Source Vector Graphics (SVG) Editor Overview
Birds of a Feather Meeting in Co-operation with Siggraph 04 at the Los
Angeles Convention Center
http://www.siggraph.org/s2004/conference/birds/index.php?pageID=conference
Monday, 9 August
4 - 5 pm
Holiday Inn City Center
Santa Monica Room
Jon Phillips + Jon Cruz
###
Inkscape: Draw Freely.
2006 Jan 25
4
Cannot :order when using :offset and :limit in find
Hello all.
I am using the Paginate_with_ajax code as described on the wiki but I am
running into the following problem. The following code will work fine
and retrieved unsorted records in a hunky dory fashion:
@componentlogs = Componentlog.find(:all,
:conditions => [ "cl_compname like ?", @criteria ],
:offset => offset,
:limit => items_per_page )
However if I try and add an
2008 Jan 19
6
Quiet Backtrace in RSpec
I''m using RSpec on Rails and would like to clean up the backtraces, so I
went looking for an RSpec equivalent to ThoughtBot''s Quiet Backtrace
gem<http://thoughtbot.com/projects/quietbacktrace>.
I found Spec::Runner::QuietBacktraceTweaker in the RDOCS, but I can''t figure
out how to use it. Can I add something to spec_helper.rb that will
utilize