Displaying 20 results from an estimated 2000 matches similar to: "find_by_sql and xml_serializer problems"
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi,
Is there an easy way of querying an active record for a maximum column
value? I need to do queries like:
SELECT MAX(salary) FROM employees
TIA,
Jeroen
2006 May 19
2
Icecast2 Status Page Parser
Does anyone have a Perl or PHP Icecast2 Status Page Parser?
Thanks.
-greg.
__________________________________________________________________________
Greg J. Ogonowski
VP Product Development
ORBAN / CRL, Inc.
1525 Alvarado St.
San Leandro, CA 94577 USA
TEL +1 510 351-3500
FAX +1 510 351-0500
greg@orban.com
http://www.orban.com
2006 Jul 17
2
actionmailer / @recipeints
Hi all,
i''m trying to email multiple people based on certain criteria.
i do a search like
@stacks = Group.find(:all, :conditions => ["component_id = ?", 2])
this populates stack to contain multiple groups with component_id =2.
How do i populate @recipients to contain all possible @stack.email.
Let me clearify. Each stack has its own email, and i need to include
each
2004 Aug 06
3
Dummy soundcard driver for Windows (OT)
We want crossfading so we need to use the SQRSoft crossfading Winamp
output plugin.
Ross.
Stefan Neufeind wrote:
> If thats the problem, why didn't you mention that before?
>
http://classic.winamp.com/plugins/detail.jhtml?componentId=28451
Null Output Plugin
Null Output Plugin allows to run WinAMP without need of any soundcard
installed in the system. [...]
On 10 Jun 2003 at 8:21,
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all,
In my controller I am doing the following to populate a nested form for a
has_many through association:
def new
@specification = Specification.new
Component.find_each.each do |component|
@specification.component_specifications.build(:component_id =>
component.id)
end
The idea being whenever someone creates or edits a form, it will be
populated with all
2004 Aug 06
3
Multiple OGG streams?
> > I'd like to set up two streams, one for broadband users & one for modem
> users
> > (and I want them to be playing the same thing at the same time). Is
this
> > possible with Icecast 2 and Oddcast, or any other win32-compatible OGG
> > software combination?
> >
> > Thank you!
> >
> Use Oddsocks' stream Transcoder to lower the bitrate
2005 Aug 22
5
XML "Un-Builder?"
I''ve been unserializing XML in PHP with the XML_Serializer class, and
I''m wondering if anyone knows of such a class for Ruby. Nothing
fancy, just perhaps a simple way of converting arbitrary XML to a
Ruby object. Maybe this has been implemented somewhere already?
Thanks,
Raymond
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all,
I am getting ActiveRecord to produce XML with
render :xml => @user.to_xml
However, on the client end it is a bit annoying for me to deal with
attributes like first-name. I would much rather have first_name.
Is there any way for me to turn off the behavior of converting _ to -?
This seems to be done by a call to dasherize inside the to_xml of
2006 May 31
2
ActiveRecord and database metadata. How much can I get?
All,
I have need of getting at some underlying database metadata for
ActiveRecord descendants.
Does anyone know if I can get access to the following attributes of the
underlying column for a given ActiveRecord object:
Is it a currency object?
Is it nullable?
Is it a signed int?
Is it searchable?
Column length
Column name
Column precision
Column scale
Column data type - how specific can I get
2008 Apr 09
3
help with model relationship for Product/Bill of Materials
I am struggling to find the best way to set up relationships to
achieve this so that it fits the rails idioms.
I have a table of products and I want to be able to create a bill of
materials for a product..
So a product can either be a single item, or a package consisting of
several other products.
I have created a table:
----
class BomItem < ActiveRecord::Base
belongs_to :product
2008 Jan 08
1
howto rebuild a object from a received xml hash structure ?
im my web server app , i have an action to be used as a REST web
service
# GET /user/membership.xml?email=emailaddress
def membership
@user = User.find_by_email(params[:email])
respond_to do |format|
format.xml { render :xml => @user.to_xml( :only =>
[ :first_name, :last_name, :display_name, :membership_type, :membership_at], :skip_types
=> true)}
end
end
my
2005 Dec 30
3
Too many columns for list.rhtml to display on one page
I''ve gone once through the Agile book and am now attempting my own rails
app. I''ve created a table named ''volunteers'' with over 15 columns. The
problem is the default list.rhtml that is created with the scaffold,
shows all the columns. I only want to show 4 of them with the list
view.
Where would I start to only return a handfull of columns to the
2008 Mar 03
2
how can i know type of attribute with active record
Hello,
In my database, I have a table "products" with attributes :
- id
- title ->string
- desc -> text
I use active record, but I don''t know why recover the type of this
attribute with active record?
I try attributes_before_type_cast but I don''t see the type
Can you help me?
Excuse for my english (I''am a young student french)
--
Posted via
2006 Apr 21
5
Simple Question: How to merge SQL results?
Hopefully an easy one, how do I merge two or more SQL query results?
Example:
result1 = find_by_sql(x)
result2 = find_by_sql(y)
What is the best way to merge result1 and result2? I want to be able
to reference the objects as if they were obtained via one query.
Cheers,
Dan
2005 Oct 28
4
find_by_sql column types
Hello--
There must be a better way to do this. I have a class method in my model
that finds averages and does a few calculations using find_by_sql. The
problem I¹m encountering is that all computed columns from MySQL come back
as type string. E.g.,
def self.find_averages(domain_id)
if @@domain_average
return @@domain_average
else
@@domain_average =
2006 Feb 03
9
Because I''m very slow - trying to use console
I can''t see how to use variables so I am using console to test things
out...
clients table - a column named first_name
My very brief console session...
>> clients = Client.find_by_sql("select * from clients where first_name
= FN")
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703 Mcolumn
"fn" does not exist Fparse_expr.c L1034
2005 Dec 21
7
use of SET command in find_by_sql
Hi,
I''m trying to execute something like this method in a model:
def self.sql_for_rankings()
sql = "SET @counter:=0;"
sql << " SET @counter:=0;
SELECT *, @counter:=@counter+1 AS rank
FROM testscores. "
find_by_sql(sql)
end
Where the new rank column is a kind of autoincrementer inside of
2006 Apr 19
2
Using Reflections to find out ActiveRecord class association
I want to find out what are the associations with another active record
class. So If my class is as below:
Class Component < ActiveRecord::Base
has_many :branches
end
class Branch < ActiveRecord::Base
belongs_to :component
end
and then I do
Component.reflections[:branches].active_record
I would expect that to be Branch but it is in fact Component.
The inspection of
2006 Mar 24
1
Multiple table relationships
Hello,
I''m just starting out with some Rails development and have the following
table structure. I understand how to do a two table has many join but I
actually need to relate a third table. Here is my structure:
components
id
name
updated_at
elements
id
name
updated_at
element_types
id
name
updated_at
components_elements
component_id
element_id