similar to: creating a model that has other models as elements

Displaying 20 results from an estimated 6000 matches similar to: "creating a model that has other models as elements"

2006 Mar 17
2
Controller/View Organization (Newbie Question)
Good afternoon all... First, let me apologize for asking a potentially dumb question. I''m new to both Ruby and Rails, but I do have a long background in OO programming and web development. My question is about how to structure controllers for the various models which I will need in my application. My data will look something like this: Dog - (has_many) TrainingSessions -
2006 Aug 16
3
AR: column methods?
In a model, it seems that methods for column access are only created when one column method on an object is accessed. So, how can one override the default column methods? For instance: create_table "dogs", :force => true do |t| t.column "color", :string end create_table "tails", :force => true do |t| t.column "dog_id", :integer,
2006 Jul 04
1
Has_many :through with checkboxes?
Just when I started getting the hang of has_and_belongs_to_many relationships, I realize that I should probably convert several of my app''s joins to has_many :through type relationships. One example, pairing users with categories via subscriptions, where each user can be the "owner" of a category, has given me particular trouble when I try to update a user''s
2006 Feb 06
4
Relationship Question (STI)
My girlfriend and I have been dating for two years, and she just told me she has an STI... Actually, I currently have three different models, like: Dog, Whale, Monkey They all have some similar attributes, but, they are unique enough to break into their own models. I could use STI, but I think the table would just have too many columns. Now, I wanted to let the Dog''s, Whale''s
2012 Jan 27
1
Horizontal stacked 100% bars with ggplot2
Hello, R friends, I'm trying to crack this nut: Example Data. pet    gender dog    male dog    female dog    male cat    female cat    female cat    male Plot Task. Horizontal 100% bars where y axis shows gender factor (male vs. female) and x axis shows percentage of kind of pets (dog vs. cat) so that % dogs + % cats are stacked in 1 bar and sum up to 100% (for each gender group 1
2012 Jun 28
3
loop through and modify multiple data frames
Hi Newbie question: I have a set of data frames that I want to do the same calculations on each. I've found out that I can put them in a list and loop through the list to do the calculation, but not put the results back into each data.frame.. For example three data frames cats, dogs, birds where >cats name eats_kg 1 bob 3 2 garfield 4 3 chuck 6 and dogs and birds are similar but not
2012 May 03
3
inheritance with rails.
Hello. I''ve read about examples on inheritance with rails. Here is an example: http://juixe.com/techknow/index.php/2006/06/03/rails-single-table-inheritance/ The way is to add a type field in the table. So if I have an Animal class with an attribute name, I can inherit from this class like: Dog < Animal, Cat < Animal, and so on. With the type field in the table I can do Dog.all,
2006 Feb 22
15
Fixtures and Relationships
In my daily development, I migrate back and forth between versions, and often do: rake load_fixtures... ... in order to populate my development database with fun data. Now, with any HABTM relationship, there are failures, as there is no way to say "which" fixtures to load first. Within an actual functional or unit test case, you could simply load them in the proper order, but
2010 Sep 24
1
POSIXct: Extract the hour for a list of elements
Hi, I have a list/data.frame 'pk' of POSIXct dates, and I'd like to extract the hour for each row. I know that if I have an individual POSIXct object, I can extract the hour by converting to a new object with: new.lt <- as.POSIXlt(<single POSIXct object>) new.lt$hour But I can't figure out how to apply this for a list of such dates in a vectorized form. I can write a
2005 Dec 18
0
Difficulty with creatating a model
Hi everyone, I''ve just started with Rails and Ruby. I just started to play one of those RPG and to get my feet wet I''m writing an app to keep track of item fusions. So the scoop is that item can be fused with another items to create a higher level item. The higher level items can be fused to create even higher level items ... etc. I''m using MySQL to store the data.
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
Hi everyone, I''ve tried posting the same question to the list last Friday but somehow did not see it being posted.. I''ve just started with Rails and Ruby. I just started to play one of those RPG and to get my feet wet I''m writing an app to keep track of item fusions. So the scoop is that item can be fused with another items to create a higher level item. The higher
2010 Aug 29
0
match default verb
The default verb for match is :any. This means for: match ''dog/bark(/:num)'' => ''dogs#bark'' # get 3 barks match ''dog/eat'' => ''dogs#eat'' # post breakfast someone could post on dog/bark with :louder or get on dog/eat with :breakfast. This is annoying and messy, and definitely not RESTful. In moving to Rails 3,
2010 Jan 10
0
commandArgs return value
Hello, I plan to use a script with R CMD BATCH on different platforms Linux, Windows and Mac OSX. I use the commandArgs(trailing = FALSE) function to retrieve the name of the script and the arguments (example below with output.) The online docs for "Introduction to R" (sections B.1 Invoking R from the command line and B.4 Scripting with R) and help("commandArgs")
2012 Dec 13
2
replace parenthetical phrases in a string
R-helpers, I have a vector of character strings in which I would like to replace each parenthetical phrase with a single space, " ". For example if I start with x, I would like to end up with y. x <- c("My toast=bog(keep=3 no=4) and eggs(er34)omit=32", "dogs have ears", "cats have tails (and ears, too!)") y <- c("My toast=bog and eggs
2006 Jun 30
0
Mongrel-users Digest, Vol 5, Issue 24
>> Can I change my vote to http://samugliestdog.com/Sam162edited.jpg yikes! how''d that get past my firewall? +1 On 6/30/06, mongrel-users-request at rubyforge.org <mongrel-users-request at rubyforge.org> wrote: > Send Mongrel-users mailing list submissions to > mongrel-users at rubyforge.org > > To subscribe or unsubscribe via the World Wide Web, visit
2008 Jan 10
1
question regarding hypothesis testing in contingency tables
Hi R-users! I have the following example: a<-data.frame(cat=c(5,10,15), dog=c(5,10, 15), mouse=c(10,10,20)) b<-data.frame(cat=c(15,10,5), dog=c(15, 10, 5), mouse=c(20,10,10)) rownames(b)<-c("scared", "happy", "sad") rownames(a)<-c("scared", "happy", "sad") Let's say that a and b are 2 contingency tables and 5,10, 15, 20
2008 Jul 24
2
factor question
Hi! Suppose I have a factor: > fac1 <- factor(rep(c("dog","cat","tree"),c(2,3,4))) > fac1 [1] dog dog cat cat cat tree tree tree tree Levels: cat dog tree > length(fac1) [1] 9 Now I want to get rid of the dogs: > fac1 <- fac1[3:9] > fac1 [1] cat cat cat tree tree tree tree Levels: cat dog tree > How should I remove the dog from the
2008 Dec 18
1
inserting zero instances with zeroes in a matrix
Hi all, Suppose I had the below example where a survey was carried out recording the number of each type of pet in each house count<-c(2,1,2,1,2,3,4) house<-c("house1","house1","house2","house3","house4","house4","house4")
2000 Mar 18
1
abline(coef=c(1,1)) different behavoir to screen and postscript 1.00 under windows
hi listees- Running windows 2000 and r 0.99 or 1.00; I get different lines on screen and print out: > j<-read.table("jnk.rin",head=T,sep="\t") > attach(j) > #gives lines I want > qqnorm(Dog,pch="o",main="Cumulative Frequency Log Dog Size",log="y",sub="Figure 2",x =c(-3,3),ylim=c(2000,1000000)) >
2006 Sep 14
1
plotting all subgroups with augPred
All, I have a question RE plotting the prediction lines of a random effects model via augPred. I'll illustrate via the Pixel dataset within the nlme package: library(nlme) attach(Pixel) fm1Pixel = lme(pixel ~ day + I(day^2), data = Pixel, random = list(Dog = ~ 1)) plot(augPred(fm1Pixel)) ### 10 fitted lines since there are 10 dogs fm2Pixel = update(fm1Pixel, . ~ . + Side)