similar to: Instance or local vars for field helpers in partial template

Displaying 20 results from an estimated 8000 matches similar to: "Instance or local vars for field helpers in partial template"

2006 Jun 26
3
RJS Templates with dynamic id names
Due to the use of partials, I''m trying to dynamically generate the ids being affected in an rjs template, but I can''t seem to get the syntax to work. Basically, I need to do the equivalent of this from the .rhtml template: page.show ''mything<%= @thing.id %>'' No joy there. Apparently RJS templates don''t work with embedded ruby. So I tried:
2006 Feb 28
12
Examples for Money library ?
Can anybody share some examples of their Money implementation ? I''m trying to setup a Model to use this library, but can''t seem to wrap my head around how it is exactly supposed to work. My Model (Foo) looks like: =============== composed_of :commission, :class_name => "Money", :mapping => [ %w(commission_cents cents), %w(commission_currency currency) ] Yet, in
2006 Jun 12
3
Default value for model var
I know this has got to be a really dumb question, but here goes anyway. I''ve got a model with an associated table. One of the columns in the table is ''date_created'', which I want to be set to the date/time each row was added to the table. Seems to me that setting this in the initialize method for the model would be the right thing to do,... class MyThing <
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
2006 Jun 18
2
Why can''t I use a session? (Symbol as array index)
Hi All I can''t for the life of me see what is wrong with this. Maybe it''s cause it''s midnight... I want to put some data in a session and I have some code like this: class ApplicationController < ActionController::Base model :mything def ApplicationController.chosen_thing session[:chosen_thing] ||= MyThing.defaultThing end end So whenever I try to
2006 Mar 03
1
arrays in model objects
Having a dumb model object like def MyModel attr_accessor :property def initialize @property = Array.new end end when it is used for for interaction by "@object = MyModel.new" and then used in view as <%= text_field ''object'', ''property'' %> shoudn''t it be rendered as?: <input type="text"
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
2006 Apr 08
2
ActionView::Helpers::FormHelper instance methods should take an object reference rather than an object_name.
Hi ActionView::Helpers::FormHelper methods (e.g. #text_field, #check_box...) take object_name as an argument. From this argument they infer a name that is supposed to contains the reference to the relevant object. I can''t see why the FormHelper methods were designed that way. Compared to simply passing them a reference, the current way seems too complicated and an invitation to problems
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
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
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
2008 Jul 28
1
callback executed like after_save but after transaction
I''m trying to add some code for my ActiveRecord class so that it is executed whenever an object is updated, this code is a seperate process that reads from the same table represented by my model class so when it runs it needs the database to be up to date. In the following situation this is fine: # MyModel def after_save `/usr/local/bin/update_models -i #{self.id}` end # controller