Displaying 20 results from an estimated 10000 matches similar to: "Using ActiveRecord outside of Rails error"
2006 Apr 25
2
Bug in Rails 1.1 implementation of before_filters
I just spent a few hours tracking down a bug in Rails 1.1, so I thought
I''d post the issue and a workaround just in case anyone else hits it.
I designed a security enhancement so that controller methods can be
protected by preceding them with a role. The standard Ruby
method_added() callback is used to detect when controller methods are
added, and then I manipulate the
2007 Aug 23
7
custom sort routine
is it possible to write a custom sort routine for ferret?
I use ferret right now to index all my products. One of the variables
in these product documents is the product popularity, where 1 = best
selling production, 2 = 2nd best, etc..
Right now, I''m just sorting by the popularity column in my search
results, although this doesn''t always provide "good" results,
2006 Apr 07
2
ActiveRecord find all based on array -- need ids from array
Does anyone know if it is possible to perform an ActiveRecord find by
passing in an array? I would like to be able to do the following:
MyModel.find(:all, :conditions => ["user_id in (?)", users])
The problem I run into is that the returned SQL contains the to_s()
output of the User object, not the ids of those users. Is it possible
to change this behavior? I attempted to
2010 Jan 01
1
Questions bout SVM
Hi everyone,
Can someone please help me in these questions?:
1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?:
mymodel <- svm(myformula,data=mydata,cross=10)
sqrt(mean(mymodel$MSE))
But if I don’t use crossvalidation, I have to use the following to calculate RMSE:
mymodel <- svm(myformula,data=mydata)
mytest
2018 May 18
3
Exporting to text files
I have dose response data analyzed with the package 'drc'.
'summary(mymodel)' prints my kinetic parameters. I want
that text in an ASCII text file. I want to get exactly what I
would get if I copied and pasted from the terminal window.
I've read the documentation on data export to text files here:
2008 Apr 17
1
How to extract vectors from an arima() object and into a data frame?
This should be very easy, but alas, I'm very new to R. My end goal is to
calculate p-values from arima().
Let's say I just ran this:
> MyModel <- arima(y[1:58], order=c(1,0,0), xreg=MyData[1:58,7:14],
> method="ML")
> MyModel
And I see:
arima(x = y[1:58], order = c(1, 0, 0), xreg = MyData[1:58, 7:14], method =
"ML")
Coefficients:
ar1
2006 Nov 16
2
dynamically adding static (class) methods to a class
Hello again,
I guess this is more of a Ruby question, but here goes anyways...
I want to intercept all calls to non existent class methods and then
call an existing class method with the non existent name.
In code...
class MyModel < ActiveRecord::Base
def MyModel.method_missing(symbol, *args)
MyModel.func(symbol.id2name)
end
def MyModel.func(func_called)
puts "You
2018 May 18
0
Exporting to text files
?sink
On May 18, 2018 9:47:25 AM PDT, Ed Siefker <ebs15242 at gmail.com> wrote:
>I have dose response data analyzed with the package 'drc'.
>'summary(mymodel)' prints my kinetic parameters. I want
>that text in an ASCII text file. I want to get exactly what I
>would get if I copied and pasted from the terminal window.
>
>I've read the documentation on
2006 May 04
1
Instance or local vars for field helpers in partial template
I''m getting confused.
If I have a view (.rhtml), I can use a field helper like:
<%= text_field :mymodel, :attribute %>
This uses the value from @mymodel.attribute
Now, if I am rendering a template normally (i.e. not partial), I would
expect @mymodel to be a model object defined as an instance variable in
the controller.
However, if I am rendering a partial template, I
2007 Mar 04
1
using AR outside of rails
I''ve seen a number of ways to use AR outside of rails, and am
wondering what other think is the best approach for my particular
application.
The application is in it''s own module namespace. To use it within
rails you just require it in application.rb and instantiate a class to
call methods on. It''s also well suited to be used from other various
applications though.
2006 Mar 01
2
error: uninitialized constant
total rails nuby here. I have a table "thumbnails", hence the model
Thumbnail. I''m extending the Thumbnail class with a few constants
needed for thumbnail cropping:
class Thumbnail < ActiveRecord::Base
SOURCE_FILE_PATH = "path/to/source"
TARGET_FILE_PATH = "path/to/target"
TARGET_WIDTH = 100
TARGET_HEIGHT = 100
end
Now, in my controller
2006 Apr 14
5
state_models plugin and file_column?
I was looking at Kyle Mawell''s extremely nifty-looking StateModels
plugin
http://www.kylemaxwell.com/articles/2006/02/06/fun-with-single-table-inheritance
and before I go down the road with it, I was wondering if anyone has
used it with file_column.
The way file_column deals with an uploaded file -- by storing it to the
filesystem in a path that employs the model name and id --
2012 Oct 31
2
Problema con la función lm
Buenos días:
Tengo un determinado código en R que en una máquina funciona correctamente, pero en otra devuelve un error del tipo "Error en as.formula(mymodel): Objeto ''mymodel'' no encontrado''"
En mi código:
mymodel <- "y ~ x1[, 1] + x2[, 1]"
res <- lm (as.formula(mymodel))
¿Qué puede estar motivando ese error?. La máquina en la que falla
2013 May 21
1
Calculating AIC for the whole model in VAR
Hello!
I am using package "VAR".
I've fitted my model:
mymodel<-VAR(mydata,myp,type="const")
I can extract the Log Liklihood for THE WHOLE MODEL:
logLik(mymodel)
How could I calculate (other than manually) the corresponding Akaike
Information Criterion (AIC)?
I tried AIC - but it does not take mymodel:
AIC(mymodel)
# numeric(0)
Thank you!
--
Dimitri Liakhovitski
2010 Dec 29
2
Referring to an object name from within a function
Can anyone show me how to refer to an object name that is passed to a
function, from within the function?
For example:
MyModel <- 1
test <- function(x) {
if(x == 1) {cat("x is a valid object.\n")}
}
test(x)
What I would like this to do is pass MyModel to function test, and if it
passes a test, be able to print "MyModel is a valid object."
Thanks.
--
View this
2007 Sep 12
3
Can''t disable ferret when running in Mongrel
In my environment.rb I say the following:
MyModel.disable_ferret
puts MyModel.ferret_enabled?
The console works as expected:
script/console
false
>> MyModel.ferret_enabled?
=> false
I can then edit an instance, ferret remains disabled and the changes
are not immediately indexed.
However, when I start mongrel Ferret is initially disabled, but then
somehow becomes enabled again
2005 Apr 24
2
Model names in controllers
Please excuse yet another newbie question...
I''m getting this error:
MissingSourceFile in <controller not set>#<action not set>
c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/dependencies.rb:75:in `require_dependencies'': Missing model MyModel.rb
From these lines of code:
class MyModelController < ApplicationController
2011 Feb 12
2
Predictions with missing inputs
Dear users,
I'll appreciate your help with this (hopefully) simple problem.
I have a model object which was fitted to inputs X1, X2, X3. Now, I'd like
to use this object to make predictions on a new data set where only X1 and
X2 are available (just use the estimated coefficients for these variables in
making predictions and ignoring the coefficient on X3). Here's my attempt
but, of
2006 Jan 19
1
Model Validation & Floating Attributes
Hello all !
I have a model being validated that spits it''s error messages on the
resulting page using:
error_messages_for(:mymodel) .... Basic stuff. It''s working perfectly.
Now, I have something else I want to check on the same page (that isn''t an
attribute to the Model)... and am trying to add it using:
@mymodel.errors.add_to_base("another error here")
2009 Sep 03
1
Help with GLM please!
Dear experts,
I have a few quick questions related to GLMs:
1) Suppose my response is of the type Yes/No, How can I control which
response I'm modelling?
2) How can I perform Type III tests? Is it with -> drop1(mymodel,
test="Chisq") ?
3) I have a numerical variable which I converted to an ordered factor as
shown below, but in the summary results of the logistic regression I