Displaying 20 results from an estimated 2000 matches similar to: "cannot destroy child records"
2008 Apr 10
1
Tukey in R, extracting values
hey,
how can i extract the values from the CI's when i use following code for a
tukey test?
the output shows three CI's and i know it should work with 'names but i
don't really know how...
thanks
library(multcomp)
data1$soort<-as.factor(data1$soort)
amod<-aov(waarde~soort,data=data1)
g<-glht(amod, linfct=mcp(soort = "Tukey"))
confint(g)
--
View this message in
2006 Dec 05
1
has_many :through questions
I have a database with 4 tables
Months has_many :weeks
Weeks has_many :days
Days has_many :hours
Hours
Weeks belong_to :month
Days belong_to :week
hours belong_to :day
I need to access the month_id in the Hour.rb model.
find(:first, :conditions => ["user_id = ? AND month_id = ?", user_id,
month_id])
Thanks
--
Posted via http://www.ruby-forum.com/.
2005 Dec 20
3
Single controller to browse things in categories
First off, hi, I''m [obviously] new :O)
Please excuse my question as I''m sure it''s been answered, but I can''t
find it anywhere.
I have a table of categories:
id name
1 Foo
2 Bar
I have things which belong_to categories:
id category_id subject date
1 1 my subject 07/09/2004
and Further classifications which belong_to categories:
id category_id name
1 1 More
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed
remarkable and remarkable activerecrod both gem. i''ve added both gem in
my Gemfile. i''ve added "remarkable_activerecord" as required in
spec_helper.rb.
describe Authentication do
FactoryGirl.build(:authentication).should
belong_to(:user)
2012 Jan 27
3
How to test the model dependence ?
Good morning,
I''m new to rails and am having some basic questions in development. See
if anyone can help me with a test problem. I need to test if my model
"Procedure" is linked to the workflow. If not, the system must
acknowledge an error. Below is the code that is in the file test \ unit
\ procedure_test.rb.
require ''test_helper''
class ProcedureTest <
2006 Mar 08
0
How to add something similar to :counter_cache - :avg_cache
Hi,
I was thinking of doing this with a stored procedure, but I thought it
could be better implemented in Rails.
I have several tables that hold a counter cache for other tables,
which aren''t directly related. For example:
Table ''schools'' has records that belong_to table ''counties'', and that
table has records that belong_to table
2004 Apr 29
0
Pxelinux/memdisk with Universal TCP/IP Network Bootdisk floppy
Just for the record, I want to let the list know that I succeeded in
booting a modified Universal TCP/IP Network Bootdisk floppy from
http://members.iinet.net.au/~bdriver/bootdisk/
I started with a Win98 Bootfloppy from http://www.tobs.uku.co.uk.
Then I made a disk image from this, using dd.exe from cygwin.
Then I converted this disk image from 1.44MB to 2.88MB with winimage.
Then I copied
2006 Apr 20
5
strange mysql problem
i have this model:
class LineItem < ActiveRecord::Base
belongs_to :quote
end
in the console:
>>l = LineItem.create
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '' , , , )'' at line 1:
INSERT INTO line_items (`qty`, `quote_id`,
2006 Mar 16
4
Table Relationships Problems.
I have the following tables setup:
locations
:id
:name
systemmessages
:id
:name
systemmessage_validtimes
:id
:name
:systemmessage_id
:location_id
:start
:end
The systemmessage_validtimes has a ''has_many'' relationship with
systemmessages, meaning that there could be many valid times for each
system message.
@systemMessage = Systemmessage.find(1)
E.g. I
2011 Sep 14
1
rspec and should have_many through
Hi,
Anyone can help me with rspec shoulda validations please.
I can''t get the syntax right for these validations. Please correct me
it { should have_one :tradable, :through => :trade_order}
it { should belong_to :source, :polymorphic => true }
it { should have_many :transfers, :as => :source }
this is for Rspec 2, rails 3.1,
gem "rspec-rails"
gem
2006 Apr 09
6
Write/Display AR query as Grouped Results?
I''ve got a publications table that contains an author_id foreign key and
a pubrole_id foreign key. What I want to do is query the DB using AR so
that I can get a list of all publications that belong_to a particular
author, and group the results by the pubrole.role_name (Author, Joint
Author, Editor, etc.) so that the results look something like:
Author
book1 info
book2 info
etc.
2006 Feb 28
1
adding to errors in controller?
def update
@product = Product.find(params[:id])
@product.attributes = params[:product]
if params[:main_image]
image = Image.new params[:main_image]
if image.save
@product.main_image.destroy if @product.main_image
@product.main_image = image
else
@product.errors.add_to_base(image.errors.full_messages.join(", "))
end
end
2006 Mar 21
2
Sorting by computed temporary field
Hey all,
I''m rather new to Ruby and Rails (and not great with SQL), but I''m
developing a ride sharing app and would like to be able to sort on
something I don''t have stored.
I have users, events, and rides, each of which has a zip code. Events
have_many rides, and rides belong_to events.
When an event is selected, I''d like to be able to show a list of
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all,
I''m running Rails on top of a Mongrel cluster. I have several model
classes that are going to have so many records it is not feasible to
keep them all in the same table. So I''ve split out the records into
many different tables, each with its own suffix which corresponds to
the id of the model to which all records in that particular table
belong.
For example,
2006 Mar 30
5
Heeelp - no idea what''s going wrong.
I''m working on a simple CMS. The main data type are "listings" a listing
habtm (has_and_belongs_to_many) categories and subcategories.
Subcategories belong_to categories. Subcategories are basically the same
as categories, but they are treated differently in a few situations.
The problem is, I can''t seem to write the view/controller/model code
that allows me to
2006 Jan 12
2
Can A Model Have Many belongs_to?
I am very new to Rails. After skimming through the documentation over
the last several days, I''m struggling with the appropriate use of
belongs_to. My main question is whether a model can have several
belongs_to declarations. I have not seen any examples online show that
usage. If it can, then I would like to know if it''s poor form or what
the best practices are around
2010 Aug 19
4
implementing project management and event types
I am implemented a simple project management application. Each
project has various events, and each event can be a different type.
Some event information is common, such as name, start date, close
date, and comments. I have a projects table which has_many events.
My plan is to have several sub-event tables, like event_get_access
which will contain an event_id field to link it to table events as
2006 Mar 22
2
habtm vs. has_many/belongs_to
In AWDWR David says (pg 232),
"When a Join Wants to Be a Model:
While a many-to-many relation with attributes can often seem like the
obvious choice, it?s often a mirage for a missing domain model. When
it is, it can be advantageous to convert this relationship into a
real model
and decorate it with a richer set of behavior. This lets you
accompany the
data with methods.
As an example,
2006 May 03
2
Perplexing nested transaction issue
I''ve been struggling with a strange nested transaction problem for a while.
I have a two objects with the following relationships:
Mail has_many :recipients
Recipients belong_to :mail
I''d like to update the status of the Mail object while sending mails for
each of it''s recipients. Following is a simplified example that I''m having
problems with:
def
2007 Aug 10
0
ActiveRecordAssociationMatcher
I''ve started to put together a custom expectation matcher for
specifying AR associations. Its not quite complete and I really need
to put some specs together for it, but I''d appreciate any comments.
It lets you spec your associations like this:
describe Record do
include ActiveRecordAssociationMatchers
it "should belong to artist and use a counter cache" do