search for: someclasses

Displaying 20 results from an estimated 57 matches for "someclasses".

Did you mean: someclass
2006 Mar 04
2
convert string to AR class
Hi everyone, I''m trying to convert a string passed on the command-line into an ActiveRecord class, so I can do something like this. a="SomeClass" a.find(:all) where class SomeClass < ActiveRecord::Base end This appears to work (better ways would be appreciated): a="SomeClass" b=eval a b.find(:all) However I would like to make sure
2006 Sep 27
1
acts_as_taggable with single-table inheritance?
Does anyone have any experience making this work? I installed the plugin and tried the following: class SomeClass < ActiveRecord::Base acts_as_Taggable end class SubClass1 < SomeClass end class SubClass2 < SomeClass end SubClass1.tag_with("tag") and notice that taggable_type = SomeClass when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
2014 Feb 11
2
$new cannot be accessed when running from Rscript and methods package is not loaded
Hi Accesses the $new method for a class defined in a package fails if the methods package is not loaded. I have created a test package with the following single code file: newTest <- function() { cl <- get("someClass") cl$new } someClass <- setRefClass("someClass") (This is similar to code actually used in the testthat package.) If methods is not loaded,
2007 Jul 25
2
initalizing and checking validity of S4 classes
Dear useRs and wizaRds, I am currently developing a set of functions using S4 classes. On the way I encountered the problem exemplified with the code below. For some reason the 'validity' method does not seem to work, i.e. does not check for errors in the specification of the slots of the defined class. Any hints? My understanding of the whole S4 system was that validity checks are made
2010 Apr 21
1
VERY basic question about S4 classes
Hi,   I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even though the two methods belong to the same class.     setClass(Class="SomeClass",      representation=representation(      
2005 Aug 10
1
using modules with models?
I''m trying to figure out how to use modules with my model classes. I''m going to have good number of model classes that don''t map to the database, and I''d like to put some of these in seperate modules. I''ve been wrestling with this for 2 days and can''t figure out how to get it to work. Rails seems to handle it fine for controllers, though. I
2013 Apr 16
7
puppet-cleaner: makes puppet DSL code comply with a subset of the style guide
FWIW, I''ve wrote puppet-cleaner to help me make comply thousands of lines of puppet 2.6 DSL code to puppet 2.7 style guide and expectations. I''m uploading it to github today for anyone to use. https://github.com/santana/puppet-cleaner Externally, you run puppet-clean file.pp and it can transform this: /* multiline comment trailing white space here -> */ class
2005 Mar 03
0
Scaffold in 0.10
Hi. I''ve done following things: >./scripts/generate model Someclass added self.table_name in someclass.rb with my custom tablename >./scripts/generate scaffold someclass And it logs out following : ''mybase_dev.someclasses'' doesn''t exist: SHOW FIELDS FROM someclasses ... It seems generator just ignores my table name definition... I''m noob to ruby and rails, anyone can help? Thanx.
2010 Apr 25
1
method dispatching vs inheritance/polymorphism (re-post)
Hi, I'm having trouble seeing the added value over functions defined by setGeneric vis-a-vis methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call to a generic function, ie. no need to call new(), so less typing to do for the user. But such explicit calls can also be avoided by functions like f <- function(x, y) new(Class = SomeClass, x=x, y=y). Then
2009 Nov 02
1
two small wishes (with code sugegstions) for R-core
Dear R developers, It would be great if you could implement the two minor code changes suggested below, which would help processing large objects in R. Jens Oehlschl?gel # Wish no. 1: let [.AsIs return the class AFTER subsetting, not the class of the original object # Wish no. 2: adjust write.csv and write.csv2 for multiple calls in chunked writing # Rationale no. 1: a couple of packages
2006 May 09
2
name and class href attribute in a link_to_remote
I have a link to remote and I''m trying to get the name="" and the class="" attribute in the href so the link will come out like this: <a href="action" onclick"ajax(action)" name="Title Of Link" class="someclass"> So far the link looks like this: <% for course in @courses %> <%= link_to_remote
2011 Sep 06
1
list of all methods winthin an S4 class
Hello,   How can I generate an overview/vector of all the methods winthin an S4 class? Similar to dir() in this Python code: >>> class SomeClass():  def some_method_1(self):   pass  def some_method_2(self):   pass   >>> dir(SomeClass) ['__doc__', '__module__', 'some_method_1', 'some_method_2'] >>>   Thanks in advance! Cheers!! Albert-Jan
2010 Jul 21
1
fix()ing an S4 method
Hi R experts,   The fix() function canbe used to edit normal functions. I would like to know whether it's also possible to use something similar to edit a method of an S4 class. In other words, is there a fix-like function that allows me to edit method definitions without having to go back to the source code?   setGeneric (name="doStuff",def =
2007 Jul 24
2
Dealing with nested/namespaced classes w/ describe
Hi all, Just wondering about this: I''ve been dealing with classes/modules nested in several layers of namespaces. Here would be an example of a describe block: describe ClassOne::ClassTwo::ClassThree, "description here" do ... end What would be the easiest way to write something a little more terse, like: describe ClassThree, "description here" do ... end
2006 Nov 22
2
.class call to the mock object (or any existing methods)
Hi I run into problem trying to set expectations for the mockobject.class method, I had to undefine a method before I could set some expectation. Is there any better way of doing it? object = mock() .... klass = class <<object; self; end klass.send(:undef_method, "class") # I had to do this because Mocha utilizes "method_missing(symbol, *arguments, &block) "
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make attachment_fu polymorphic, so you no longer need a different table and Model class for every associated attachment (Productimage, Ad_doc, etc). All you really need is one model and table to handel all your attachments - in some cases, anyway. I have the code working, but have run into one small hitch that I can''t seem to
2019 Nov 12
0
class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]
On 11/11/19 01:40, Martin Maechler wrote: >>>>>> Duncan Murdoch >>>>>> on Sun, 10 Nov 2019 11:48:26 -0500 writes: > > > On 10/11/2019 9:17 a.m., Bryan Hanson wrote: > >> > >> > >>> On Nov 10, 2019, at 3:36 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote: > >>> >
2019 Nov 11
2
class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]
>>>>> Duncan Murdoch >>>>> on Sun, 10 Nov 2019 11:48:26 -0500 writes: > On 10/11/2019 9:17 a.m., Bryan Hanson wrote: >> >> >>> On Nov 10, 2019, at 3:36 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote: >>> >>>>>>>> Gabriel Becker
2006 Nov 19
2
underscores, sugar, and more and more bugs
I sent this earlier under with the subject "artificial sugar causes cancer" and I think some spam filters ate it. Here it is again: ====================================== All, If you look at http://rubyforge.org/tracker/index.php?func=detail&aid=6760&group_id=797&atid=3149 you''ll see that Chad (the submitter) found the source of the bug. Unfortunately, the source
2006 Feb 14
1
Error handling
Hi, I''m stuck right now with a problem concerning error handling. I''ll try to explain the problem in short: In a controller class I have a method edit: def edit @some_class = SomeClass.find(params[:id]) end The record originates from a database table. What happens if the user enters a field that fails validation and I return to my edit page? I get the idea that th