Displaying 20 results from an estimated 3000 matches similar to: "Help with many-to-many using :through"
2006 Apr 06
4
Record retrieval in Many-to-many using :through not working
Hello,
I get an error while retrieving records from the following model structure.
Tables
foods - id, food
foodallergies - food_id, symptom_id, a few other columns
symptoms - id, symptom
Models
class Food < ActiveRecord::Base
has_many :foodallergies
has_many :symptoms, :through => :foodallergies
end
class Symptom < ActiveRecord::Base
has_many :foodallergies
has_many :foods,
2005 Dec 29
2
has_many & belongs_to with Plugins (login_engine)
Hello list,
Probably a newbie question but couldn''t find the answer in the archives.
I am using the login_engine Plugin to implement the login functionality. I
have a JournalEntry model that interacts with the journal_entries table. I
would like to link the journal entries to the user who entered it.
Essentially, it is a one to many relationship between the model User(from
2006 Mar 28
1
acts_as_taggable plugin to tag multiple fields in a model
Hello,
Is it possible to tag multiple fields in a model using either
acts_as_taggable plugin or gem? If it is not possible out of the box, can
anyone provide pointers on how I would achieve something like that?
Say I have a ''Food'' model which has ''spices'' and ''healthiness'' attributes.
I want to be able to tag on both those fields. Is that
2007 Aug 22
2
Sanitize my params and the create method
If I call .create on the param structure, are the parameters being
passed to the create method automatically sanitized for me?
e.g. Journalentry.create(param[:journalentry])
Do I have to worry about any malicious scripting making its way into the
creation of the record?
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this
2006 May 19
2
Doing and storing a Writeboard like diff in RoR
Hello all,
Anyone have any suggestions on how I could do and display a diffed piece of
text in a style similar to Writeboard (strikeouts etc.)
Q1) Are there any ruby gems for diff?
Q2) How would I represent the diffed text in styled HTML?
If there are existing tools, any ideas on how I could write this?
Thanks,
Vaishal
-------------- next part --------------
An HTML attachment was scrubbed...
2006 Oct 17
2
CTRL-C behaviour with RODBC on Solaris2.8
After loading the RODBC package version 1.1-7, Ctrl-C changes its
behaviour and is quitting R and returning to the (unix-)command prompt
on the solaris2.8 platform here. Here's what happened before and after
loading RODBC
> for (i in 1:10^5) rnorm(10)
^C
> library(RODBC)
> for (i in 1:10^5) rnorm(10)
^C
bash-3.00$
platform sparc-sun-solaris2.8
arch
2006 Jan 07
8
exposing id''d
I have been working on a small app that started with some scaffolding.
Some of my actions still have the structure where the id''s of things are
passed on the url for gets.
Whats the best way to avoid the security problems that this creates?
I am sure that there are many pages written on this topic but I guess I
have been searching for the wrong things.
Thanks
Gareth
--
Posted via
2006 May 12
2
R-2.3.0 make error on AIX 5.2
I am encountering a make error on an AIX 5.2 with R-2.3.0 and R-patched_2006-05-10 after successfully configuring them using gcc-4.1.0, gnu make, and the following configure options
CC=/usr/local/bin/gcc
F77=/usr/local/bin/gfortran
CXX=/usr/local/bin/g++
MAIN_LDFLAGS=-Wl,-brtl
SHLIB_LDFLAGS=-Wl,-G
CFLAGS='-g -O'
FFLAGS='-O'
CXXFLAGS='-g -O'
bash-3.00$ ./configure
2008 Nov 24
8
matching matrix columns to a vector
I need help with (hopefully) just one more thing. I have been fussing with this for quite some time and have decided just to give up and ask! I want to match a column in a matrix to a vector. I found a "which" command that I thought would be helpful as it does the following:
> g=c(1,5,3,2,7)
> which(g==5)
[1] 2
As the above gave which placement in the g vector corresponded to
2006 Feb 24
1
Help a n00b?
So I''m trying to do that hot new thing with AJAXy forms:
http://idiet.toasterwaffles.com/foods/list
Here''s the relevant code in list.rhtml (for the form portion)
<tbody>
<%= render_collection_of_partials "list_stripes", @foods %>
</tbody>
<tfoot>
<tr id="addFood"><%= form_remote_tag( :html =>
2008 Jun 30
1
AIX 5.3 --enable-R-shlib make error with R-2.7.1
Using AIX 5.3 and gcc-4.2.1 for building R-2.7.1 with the following
configure flags
OBJECT_MODE=64
CC="gcc -maix64"
CXX="g++ -maix64"
F77="gfortran -maix64"
FC="gfortran -maix64"
CFLAGS="-g -O3"
CXXFLAGS="-g -O3"
FFLAGS="-g -O3"
FCFLAGS="-g -O3"
LDFLAGS="-L/$HOME/usr/local/lib/ppc64
2006 Dec 15
1
How can I have two controllers use the same 'category' model if they aren't related?
Hi all,
I have two controllers - "foods" and "receipes" which map to models.
Each one will have multiple categories, but the categories are
completely different for each one - they don''t share the same
category. So they aren''t related at all.
If I wanted to do this using resources, what is the best way to set
this up? If I setup a categories controller and
2003 Aug 22
0
mangia a colori (PR#3914)
Mangia a colori II!
Keywords Population, health promotion/Public Theories, Methods & Perspectives
Abstract
An initiative of health-promotion to the expansion of the "instruments" able
to assure the control to the population on their own level of health, to
improve it through activity that partly concern to the sanitary system and
partly to other sectors, with the use of internal
2007 Aug 26
0
mysql string
hi, hope u''r all having a good week ahead -
does anyone know how to modify / change existing text in a db?
with the code
@foods = Food.find(:all)
food_rows = @foods.collect(&:fruit)
food_rows.each |r|
r.gsub("really", "")
end
i get a good end result (if the data was
Food.find(1).fruit = "we really need apples"
Food.find(2).fruit = "we really
2006 Jun 24
1
Parsing XML with REXML problem
Why can it not find my object? What am i missing here? Here is my code:
require ''rexml/document''
include REXML
# classes to represent the objects and relationships in the xml file
class Article
attr_accessor :id, :post, :archive, :ntype, :head, :blurb, :body,
:fblurb, :fimage, :att, :source, :copy, :brand
end
# the base parser
class BaseXMLParser
def initialize(filename)
2004 Feb 25
4
Computing very large distance matrix
Hello All,
I have a 131072x132 matrix for which I need to compute a regular euclidean distance matrix, which I then need to transform and run agnes() on this transformed matrix. I am having trouble computing the distance matrix as it is fairly large and I am sure I have gone over the max.
The specific error I am getting is:
Error in vector("double", length) : negative length vectors
2006 May 12
1
X11 and vfonts modules on AIX 5.2
I am trying to get R-2.2.1 to pass make check on an AIX 5.2 at work (I know R-2.2.1 is not the latest release, but I encountered make errors in my attempts to install either R-2.3.0 or the R-patched_2006-05-10 on the version of AIX I am on. I will post those errors in a separate posting from this.)
So far, configure and make finish without error for R-2.2.1 using gnu make, gcc-4.1.0, and
2000 Nov 06
5
Aggregate
Hello to all,
I recently downloaded R to my PC and am enjoying getting acquainted with it. Thank you to everyone involved in the R-project!
I am interested in doing a log-linear analysis with R on a data set with dichotomous variables. There are 11 variables (columns) and around 1000 subjects (rows). How do I aggregate my data, i.e. how do I make a new dataset that includes the variable giving
2010 Aug 11
1
How to calculate the concentration
Hi, folks,
######
food=c('fruit','fruit','fruit','drink','drink','drink')
type=c('apple','apple','orange','water','soda','soda')
value=c(2,3,1,5,7,6)
data=data.frame(food,type,value)
share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18)
2007 May 18
1
AIX testers needed
Per the request to test the latest tarball referenced below, I have
built R on AIX 5.3. There is a memory issue, please see 3) below.
1) Build with --enable-BLAS-shlib option. Builds and
passes "make check".
2) GNU libiconv was installed; R configured *without*
the --without-
iconv option. Builds and passes "make check."
3) Memory issue:
a)