Displaying 20 results from an estimated 500 matches similar to: "multiple database in the same actions?"
2006 Jan 13
1
How to disconnect to a database????
Hi,
We have experienced some problems with
ActiveRecord::Base class of Ruby-Rails. We are
building a web-application based on the Ruby-rails
framework and the web-application needs to access to
difference databases, so we do not pre-define our
database accesses in the database.yml file. In fact,
we are using the
ActiveRecord::Base.establish_connection() to connect
to our database, the function
2006 Jan 05
7
HOWTO: Combine fields from 2 two tables in 1 object
Hi all,
For a dropdownlist (showing "Company - FirstName Lastname'') I want to fill an
object @project_contacts with "Name" from table Companies and "Firstname" and
"Lastname" from table contacts. Any idea?
Regards,
Gerard.
--
"Who cares if it doesn''t do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS
2006 Jan 26
0
If you want to disconnect a database properly, there is the code:)!!!
Hi,
We have worked on a problem of connection: Connect to
two databases with a single ActiveRecord::Base model
class within the same action
The main difficulty is how to disconnect the actual
connection properly and then let the ActiveRecord
establishes a new one.
The actual function "remove_connection" removes the
connection, but its doesn''t unbind the link between
rails and
2006 Jan 11
0
Connection problem with a generic-runtime-built ActiveRecord::Base
Hi,
I''m trying to create a "runtime-generic" ActiveRecord
class, It means I don''t need to know the table or
database, before I create my program ruby-rails. So I
don''t need to predefine my database in environment.yml
file and pre-build classes inherited from
ActiveRecord::Base.
I write some code, it seems to work. However, I can''t
disconnect my
2005 Dec 21
10
can an active records maps to N tables?
Hi,
Is it possbile that one active record maps to N
tables, actually the relation is 1 to 1, I wonder it
is possible.
also can a ruby object map to N tables, instead of an
active records?
Thanks you very much:)
Saiho
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
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
2011 Oct 05
6
reporting multiple objects out of a function
Dear folks,
I?m trying to build a function to create and make available some variables I
frequently use for testing purposes. Suppose I have a function that takes
some inputs and creates (internally) several named objects. Say,
fun1 <- function(x, y, z) {obj1 <- x; obj2 <- y; obj3 <- z
<missing stuff>
}
Here is the challenge: After I run it, I want the objects to be
2011 Aug 28
2
converting matrix in array
Hi everyone,
have a small problem trying to converting a dataset in matrix form to an
array.
Specifically: data include 3D measurement -x,y,z of 59 points in 36 objects.
They are stored as a matrix (x) of 2124 rows and 3 columns.
What I want to do is to extract each subject's dataset using an array (b).
Accordingly, I tried the following command:
b<-array(a,c(59,3,36)).
The problem is
2005 Jan 11
5
global objects not overwritten within function
Dear useRs,
I have a function that creates several global objects with
assign("obj",obj,.GlobalEnv), and which I need to run iteratively in
another function. The code is similar to
f <- function(...) {
assign("obj",obj,.GlobalEnv)
}
fct <- function(...) {
for (i in 1:1000)
{
...
f(...)
...obj...
rm(obj) #code fails without this line
}
}
I don't understand
2012 Jul 24
1
Function for ddply
Hello, all. I'm new to R and just beginning to learn to write functions. I
know I'm out of my depth posting here, and I'm sure my issue is mundane.
But here goes. I'm analyzing the American National Election Study (nes),
looking at mean values of a numeric dep_var (environ.therm) across values
of a factor (partyid3). I use ddply from plyr and wtd.mean from Hmisc. The
nes requires a
2004 Jan 16
2
reference to objects
Hi,
is there a way to reference to a data object without copying it?
For example I have a huge matrix called dist and I want two objects
obj1 and obj2 to have a memeber dist that points to the matrix, but
I don't want, for memory reasons, to copy the matrix twice.
As far as I understand the following code will generate three copies
of my data:
dist <- some_code_that_generates_data
2006 Jul 07
3
attach and detach question
I have a large R program that I am constantly running over and over again. At the beginning of this program, I create a hige matrix and a huge dataframe but these are constant. What I mean by constant is that, if I run the program over later, I really should just use the old matrix and dataframe ( if they exist ) that were created in a previous run so that the program doesn't have to spend
1998 May 13
1
all.equal
I need the function all.equal which is in Splus but not yet in R. Below is a
first cut. Comments would be appreciated.
Paul Gilbert
_______
all.equal <- function(obj1, obj2, ...)
{if(mode(obj1) != mode(obj2) ) return("modes differ.")
if(class(obj1) != class(obj2)) return("classes differ.")
if(! all(unlist(attributes(obj1)) ==
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations
question here.
Using:
rails 2.0.2
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin]
mysql 5.0.45
Platform:
windows xp
The problem:
----------
I created a migration that is designed to add a column named
"deleted_at" (timestamp) and then remove a column named
"is_deleted" (boolean). The idea is to
2001 Dec 19
1
Pearson residuals in quasi family
Hi all,
This is a very silly question or something escapes me:
Let obj a simple gam poisson model. Let
>obj<-gam(....,family=poisson)
>obj1<-update(obj, family=quasi(link="log", var="mu"))
>From summary.glm(obj1) the dispersion parameter is estimated 1.165; In fact
it is:
> (predict(obj1, se.fit=T)$se.fit[1:5]/predict(obj, se.fit=T)$se.fit[1:5])^2
4
2010 Mar 05
1
Changing the Prompt for browser()
Is there a way that I can change the prompt for within a browser() call. I
often use use code like
> with(obj1,browser())
Browse[1]>
Is there a way that I can set it so that I can get something like
> with(obj1,browser(prompt="obj1"))
obj1[1]>
I know that prompt is not a valid option for browser, but it would be nice
if it were. There is an option('prompt")
2010 Mar 05
1
Changing the Prompt for browser()
Is there a way that I can change the prompt for within a browser() call. I
often use use code like
> with(obj1,browser())
Browse[1]>
Is there a way that I can set it so that I can get something like
> with(obj1,browser(prompt="obj1"))
obj1[1]>
I know that prompt is not a valid option for browser, but it would be nice
if it were. There is an option('prompt")
2010 May 26
1
problem with not in in subseting dataframe
Hi all,
I have a problem while subsetting a dataframe that is
while I am using *%in%* condition like
*stemp<-subset(temp, obj1 %in% obj2,select=c(temp))*
this is working and giving results that what ever is there is both *obj1*and
*obj2*
**
**
but I want to get values which is there in *obj1* but not in *obj2 *
can anyone help me how to get those values.
i tried with *%o%* but i am not
2001 Oct 01
1
generic default values
I have a generic function
test.equal <- function(obj1, obj2, ...) UseMethod("test.equal")
however, the only argument that specific methods use is "fuzz" so I
would like to change this to
test.equal <- function(obj1, obj2, fuzz=???) UseMethod("test.equal")
The problem is that some methods use slightly different default values
for fuzz than others. How should
2006 Jul 14
3
Migration not updating fields
So I have this fairly basic migration bit of code
class AddCounterCache < ActiveRecord::Migration
def self.up
add_column ''products'', ''backlog_items_count'', :integer, :default =>
0
end
def self.down
remove_column ''products'', ''backlog_items_count''
end
end
What I want to do in that is automatically