Displaying 20 results from an estimated 600 matches similar to: "how to order by a related class???"
2008 Feb 09
0
MVC interplay to query multiple models
I''m trying to track down why I''m getting close to desired output, but not
quite. It looks like the webpage sorta-kinda is grabbing the right
data. For instance, there are three Login objects which should be
showing and it looks like the show is grabbing three objects, so that
fits, to a degree. However, it''s just grabbing the hexadecimal object
id, and not
2006 May 16
1
:conditions on has_one realationship
Hi there,
I''m currently building a membership application and I want to be able
to select, not just all the memberships, but the most current
membership from the database on a per user basis. I have linked the
tables as shown:-
class Membership < ActiveRecord::Base
belongs_to :payment
belongs_to :person
end
class Person < ActiveRecord::Base
has_many :memberships
2005 Apr 27
5
Eager load mysteriously deletes records
Hi
This looks like a bug in ActiveRecord.
I am messing with eager loading (on 12.1) and all of a sudden records
started disappearing from a table (and I am not doing anything delete
related)!!
The following line works OK:-
@todos = Todo.find(:all, :include => [ :whens],:order => "position ASC")
The following line is mysteriously deleteing :where rows from the DB
after
2006 Jul 17
1
acts_as_tree and :include
hello there,
i have a model that uses acts_as_tree:
>class GbEntry < ActiveRecord::Base
> acts_as_tree :order => ''created_at DESC''
>end
and i want it to paginate, including all children to avoid unnecessary
db queries:
> @gb_entry_pages, @gb_entries =
> paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2006 Mar 14
3
cascading eager loading patch not working in oracle
Notice the "AS" keyword appears many times. Oracle does not support this
keyword:
ActiveRecord::StatementInvalid: OCIError: ORA-00905: missing keyword:
SELECT tim
esheets.id AS t0_r0, timesheets.start_date AS t0_r1, timesheets.status
AS t0_r2,
timesheets.cost AS t0_r3, timesheets.charge AS t0_r4,
timesheets.employee AS t0
_r5, employees.id AS t1_r0, employees.name AS t1_r1,
2006 Feb 19
2
Another "escaping" problem
Ruby 1.8.2, edge Rails (and 1.0), Mac OS X 10.4.3.
Here''s the SQL that gets generated for an eager load:
SELECT events.`id` AS t1_r0, events.`user_id` AS t1_r1, addresses.`id`
AS t0_r0, events.`name` AS t1_r2, addresses.`name` AS t0_r1,
events.`meet_at` AS t1_r3, addresses.`phone_number` AS t0_r2,
events.`created_at` AS t1_r4, addresses.`phone_service` AS t0_r3,
events.`location_id`
2006 Jun 25
2
how to write the codes in view?(newbie question)
Hi.
I have two tables and want to join them.
<genres>
id
genre_name
genre_order
<links>
id
genre_id
name
symbol
url
order
display
etc
The code of links_Controller is like below.
def list
@links = Genre.find(:all,:include => :link)
end
Below is the mysql log.
SELECT genres.`id` AS t0_r0, genres.`genre_n
ame` AS t0_r1, genres.`genre_order` AS t0_r2, links.`id` AS t1_r0,
2007 May 22
2
find :all :include broken on Oracle 10
Hi,
I am trying the following in Ruby using InstantRails 1.7 on WindowsXP
Publication.find(:all, :include => [:doc_type, :release_state] )
but I get the error:
OCIError: ORA-00904: "DOC_TYPES"."PUBLICATION_ID": invalid identifier:
SELECT publications.id AS t0_r0, publications.docid AS t0_r1,
publications.doc_type_id AS t0_r2, publications.title AS t0_r3,
2009 Jan 04
3
Table associated problem using belongs_to
I have two tables:
Table [packages]
id name user_name
-------------------
1 PK1 Ray
-------------------
Table [users]
id name full_name
-------------------
2 Ray Ray Sun
-------------------
My purpose is to find the full name when I find packages. So I modify
Model Package to:
class Package < ActiveRecord::Base
belongs_to :user,
:class_name => "User",
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to,
habtm, and the new has_many => :through relationships.
Whenever I try a
find(:all, :conditions => "some conds", :include [:relationship])
it works fine, but if I have
find(:all, :conditions => "some conds", :include [:relationship,
:other_relation])
it gets a sql error such as
Mysql::Error: You
2009 Mar 10
5
'unknow column error' when using include and associated table condition in find
Here is my weird problem.
Two models like following:
Lexeme
id:int
name:string
Structure
id:int
ref_id:string
meta_id:int
Lexeme can have many structure records through foreign key ''ref_id'' in
the structures table.
And these structure records belonging to one lexeme differs between
each other using meta_id.
And if Lexeme has structures, then there must be a top_struct whose
2006 Jan 31
4
Rails bug? Conditions on associations ignored by eager loading
I''m looking for someone to confirm the following as a bug in Rails
1.0 before I post it to Trac.
If I use eager loading on an association that has conditions defined,
the conditions are ignored.
The following example illustrates the problem. I have two tables:
create_table "blogs", :force => true do |t|
t.column "name", :string
end
create_table
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 May 20
3
In a find, can''t you use both :include and :limit ?
I''m trying to do a find that includes a join. It has to be a find
because I''m using the results for a Pagination, so I need to limit my
query to the number of results I want to display per page.
Here''s the type of thing I want to do:
Employee table <-> Skills_Employees table <-> Skills table
Let''s say I want to find all the employees who have
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys,
I just came across this oddity, not sure what to make of it yet, but
I think it might be incorrect behavior. When doing a @inst.find(:all,
:include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two
references from a belongs_to that is of the same model and of the same
table. I will get a pgerror stating that "matches", which is
2006 Jan 22
2
suggest for "ambiguous column" when JOIN associated tables
Today I face with incorrect behavior in ActiveRecord.
It take place when I try to use :include parameter for .find method.
Where are two typical cases:
1. You have record with self-referential joins
CREATE TABLE keywords (id, group_id);
class Keyword < ActiveRecord::Base
belongs_to :group,
:class_name => "Keyword",
:foreign_key =>
2012 Jun 29
3
xen sound card emulation
I have few instance of server 2008 running on xen. i want to configure them
to redirect sound. I guess I need xen to emulate sound card, Somone had
stated that they are working on patch that will support intel hda emulation
was this ever acomplished? Xen supports ac97 is there 64 bit driver for
ac97 on server 2008 ?
_______________________________________________
Xen-users mailing list
2003 Sep 08
2
live monitoring
Hello,
I've search through all of the lists and cannot find any descriptions of
live monitoring (monitoring a phone call going on between an extension and a
zaptel channel live from another extension while the monitoring phone is
muted). I am aware of the monitor function which is actually a call
recorder, but I'm looking for live monitoring from a muted extension. is
this easily
2006 Jan 06
3
Help Connecting server districts
I am working on a project to unite several local school districts. We will
have 14 different districts, every district would have their own asterisk box
on location. We all have fiber lines running to a central location at our
isd. This provides connectivity to all the districts. 1. would it be wiser to
install a asterisk box at the central location of the ISD and have all
asterisk boxes
2001 Aug 16
1
ossh, S/Key AND password authentication
I've been trying to establish the following setup:
* on port 22, a vanilla sshd that allows publickey and
keyboard-interactive requests using only protocol v2
* on port 1022, a sshd that allows publickey, password and
keyboard-interactive requests using both protocol 1 and 2
The first is meant to be open to the world, the second is accessible only
from within the (firewalled) private