Displaying 20 results from an estimated 5000 matches similar to: "ActiveRecord models w/ base condition"
2006 Feb 28
3
[AR] #{id} namespace visibility used in finder_sql
Dears,
[Rails 1.0.0]
I''m working with a legacy schema, and around my 20+ models i''ve used
some AR constructs.
They are based on a finder_sql doing some dirty sql and using #{id}
from the ''pivot'' model for extracting data in other tables.
like :
class Division < ActiveRecord::Base
set_table_name "legacy_division"
set_primary_key
2006 Aug 15
2
has_many + finder_sql & :include
Hello,
In a model I have:
has_many :things, :finder_sql => '' select * from other_things '' +
'' where id = #{id} ''
When I do MyClass.find(:all, :include => :things) I get a weird error:
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
2006 Jan 19
7
bug in has_many count?
I can submit a patch, but wanted to confirm I''m looking at this right...
The docs indicate that if you specify a has_many association with
:finder_sql, but no :counter_sql, it constructs the appropriate counter
sql by substituting the SELECT clause.
But has_many_association.rb doesn''t seem to do that -- it just passes
Base#count_by_sql the finder_sql, which doesn''t
2012 Aug 09
1
Factor moderators in metafor
I'm puzzled by the behaviour of factors in rma models, see example and
comments below. I'm sure there's a simple explanation but can't see it...
Thanks for any input
John Hodgson
------------------------------------- code/selected output -----------------
library(metafor)
## Set up data (from Lenters et al A Meta-analysis of Asbestos and Lung
Cancer...
##
2011 Dec 04
2
a weird question about gdata:::
Dear R People:
If I put in:
> findPerl
Error: object 'findPerl' not found
But if I use:
> gdata:::findPerl
function (perl, verbose = "FALSE")
{
errorMsg <- "perl executable not found. Use perl= argument to
specify the correct path."
if (missing(perl)) {
perl = "perl"
}
perl = Sys.which(perl)
if (perl == "" ||
2006 Oct 30
2
It this possible: finder_sql-like behavior for belongs_to?
Guys,
I have a need to support as has_many/belongs_to relationship on a
legacy(kind of) schema. The reason I say kind of is that the schema does
have "id" columns that are used in many associations, but this particular
has_many/belongs_to association needs to support different ones.
I''ve attached to code at the end of this email. Suffice it to say I need to
use the standard
2006 Nov 02
6
Multiple items in the where clause while updating...
Hi
The following is a database table named friends.
+-----+------+------+-------+
| sid | id | fid | ftype |
+-----+------+------+-------+
| 30 | 1 | 2 | F |
| 31 | 1 | 3 | R |
| 32 | 3 | 2 | F |
| 33 | 3 | 4 | F |
+-----+------+------+-------+
I want to update the ftype field based on id and fid.
I want to achive the following.
Update friends
2007 Mar 21
1
Eager Loading with custom :finder_sql
Is there any way to do eager loading when using custom :finder_sql ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
I''m sure there''s something right under my nose that I''m missing. I
have two tables with two parallel one-to-many relationships. I wish to
use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and
2006 Mar 14
4
has_one
I''ve got an order model that stores order data.
One piece of data is a credit card type, which is a digit 1,2 or 3.
I have a cardType model that has an id, shortName and LongName for the
credit card merchant (visa, mastercard, amex).
I want to be able to say: order.cardType.shortName, but can''t seem to
get has_one working. It works with has_many and a finder_sql statement
on
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
I have a pointer to a function that I need to invoke without going
through llvm::Module::getOrInsertFunction. This example does not work:
static int add(int x, int y);
llvm::Value *one, *two;
llvm::Constant* addfn
= llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add);
llvm::Type* args[] = { Int32Ty, Int32Ty };
llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty,
2011 Mar 31
0
[LLVMdev] inserting exit function into IR
On Thu, Mar 31, 2011 at 9:31 PM, George Baah <georgebaah at gmail.com> wrote:
> Hi Joshua,
> I have a function foo and I want to insert exit(0) at the end of foo.
> The problem is M.getFunction returns null, which is understandable. I am not
> sure what to do. Below is the code snippet.
> void foo(int argc, char* argv[]) {
> printf("hello world\n");
>
2012 Jun 19
0
[LLVMdev] Cast Pointer Address to Functions
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Xin Tong
> Subject: [LLVMdev] Cast Pointer Address to Functions
> I have a function address held in an uint64_t. I would like to cast
> the function address to a function prototype and create a call to the
> function in LLVM. How could I do this ?
This is what works for us:
2011 Mar 31
3
[LLVMdev] inserting exit function into IR
Hi Joshua,
I have a function foo and I want to insert exit(0) at the end of foo.
The problem is M.getFunction returns null, which is understandable. I am not
sure what to do. Below is the code snippet.
void foo(int argc, char* argv[]) {
printf("hello world\n");
exit(0); //***I want to insert this exit
}
My llvm code snippet is
vector<const Type *> params =
2006 Jan 06
1
has_many with :finder_sql question
hi all,
I have a Class, Client, which has_many projects (Project class). the
projects depend on a session_id variable, however. So the question
is, how can I do the following:
has_many :projects,
:finder_sql => "SELECT p.* FROM projects p INNER JOIN
projects_users pu ON pu.project_id = p.id WHERE pu.user_id =
#{session[:user_id]}"
The problem is that I need to filter a
2002 Dec 20
1
smbclient and large file support
smbclient (and smbtar) in version 2.2.7a (and prior) has problems with
large files (> 4GB). The following patch (against 2.2.7a) fixes all
known problems with this. This code has been checked into the CVS tree
in all branches as well.
--
======================================================================
Herb Lewis Silicon Graphics
Networking Engineer
2006 Jan 17
15
legacy database and finder_sql nightmare!
This is my first rails app with a legacy database and I''m having a
terrible time getting the models set up correctly. I have an order
table that has a primary field named order_number. I have a name table
with a primary of item_number. These two tables are liked by the
item_number and the order_number, but not as you might think. If the
order_number is 2500, then each entry in
2011 Apr 05
3
[LLVMdev] inserting a print statement into IR
Hi Everyone,
I am trying to construct the print statement : printf("value:%d\n",
value);
This is my llvm code. It is seg faulting at
builder.CreateGlobalStringPtr(str,"").
Thanks.
George
vector<const Type *> params;
params.push_back(Type::getInt8PtrTy(M.getContext()));
FunctionType *fType =
FunctionType::get(Type::getInt32Ty(M.getContext()), params, true);
Constant
2006 Jul 01
0
activerecord generating wrong syntax with postgresql
I''m using activerecord outside of rails and find_first generates sql
that postgresql doesnt'' like. This is rails 1.1.4, with everything up
to date via "gem update".
This is the command line:
ruby -rrubygems seca -c ../etc/seca.cnf cert --export 1 --format
pkcs12 --key root.key >root.pfx
This is the error:
(PGError: ERROR: argument of WHERE must be type
2005 Dec 30
5
HABTM with finder_sql problem (Rails bug?)
I''m building an app that needs i18n support across the entire database
(i.e. localized attributes). In order to do this I''ve created a
special HABTM join table that can be associated with _any_ other
table:
create table language_strings (
for_table varchar(255) not null,
foreign_id int not null,
language_id varchar(5) not null,
attr_name varchar(255) not null,
value text