Displaying 20 results from an estimated 1000 matches similar to: "duplicate entry mystery"
2006 Aug 16
0
mysterious ''duplicate entry'' database error when building table
hi,
i tried posting this yesterday, but i never saw my message make it to the list
so i suspect something went awry..
my rails app has some ''sync'' code where it connects to a remote db, grabs the
records from a table, deletes all the records from a table which is a local
copy, and then rebuild the table with the records fetched on the remote db..
it boggles the mind how a
2007 Jul 12
0
[retry] fixture_references: "Mysql::Error #HY000"? (fwd)
I''m resending this with additional information, as I''ve had no
response. I''ve been trying to use the fixture_references plugin,
and I seem to be getting lots of:
1) Error:
test_truth(DeviceTest):
ActiveRecord::StatementInvalid: Mysql::Error: #HY000Field ''description_id'' doesn
''t have a default value: INSERT INTO devices (`id`) VALUES (2)
2010 Nov 24
0
Surprise in (delete_all | clear | destroy_all) on association
Hi,
I was very surprised by difference of delete_all on association vs
model(delegated to relation).
Given TaskFilter.has_many(:qualifiers, :class_name=>''TaskFilterQualifier'')
TaskFilter.delete_all => one DELETE statement
Without :dependent option on "qualifiers" association
TaskFilter.first.qualifiers.delete_all =>
SELECT `task_filter_qualifiers`.* FROM
2006 Jul 17
0
Difference between mongrel and webrick handling request.request_uri
If I do this GET request:
GET /comments/new?description_id=1 HTTP/1.1
what ends up in request.request_uri is different for mongrel and webrick:
Mongrel: "/comments/new"
Webrick: "/comments/new?description_id=1"
The mongrel behaviour breaks my app because I''m storing the uri to
redirect to it later. Mongrel even logs the request as:
127.0.0.1 - [Mon, 17 Jul 2006
2006 Dec 19
2
Dedupping Has_many through, :unique=>true
Hi, In the Agile book, it is told that by putting a :unique => true will
dedup the row with ActiveRecord.
But it''s not working out for me. Do I need edge rails for this?
I simply want to dedup any join model associations, for instance:
category_id | inventory_id
384 1 first entry
384 2 this would be ok.
384 1 this would
2006 Jan 18
2
categories/recipes & books/descriptions - has_many vs has_one => id question
People,
In the cookbook eg, categories has_many recipes but in a book eg, book
has_one description - doesn''t that mean that the id of the description
should be the same as the id of the book (instead of having it''s own
"description_id" in the book table?
Thanks,
Phil.
--
Philip Rhoades
Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney
2006 Mar 29
2
delete_all not resetting auto incement in database
Hey
I''m writing a simple admin interface thats reading user data (skills)
from a comma separated file.
To clear the database before inserting new skills, I use
Skill.delete_all
Then I insert the new values I read from a file. Everything goes well
up to the point where I see that auto-generated ID''s are not starting
from 1. They start off at 840 (responding to the number of
2006 May 17
0
teardown not cleaning the BD?
Hi,
I am a bit confused, I have a few functionnal tests were I add/delete
records on top of the ones provided in the fixture and it seems like the
records are surviving the teardown. Isnt teardown supposed to be ran
after each test? So if I have something like:
def teardown
Client.delete_all
Concept.delete_all
Variation.delete_all
ClientVariation.delete_all
end
All the
2006 Jan 04
3
ActiveRecord delete_all With Sanitized Parameters?
Hi there
I''m trying to delete a set of active record objects based on certain
conditions. I''d like to do something like the following:
Context.delete_all("uri IN (?)", uris)
But delete_all doesn''t allow multiple arguments. Since I don''t have
the IDs for the objects I want to delete, I can''t use delete(id), and
have resorted to this,
2006 Jul 26
7
Delete_all causes a deadlock on MSSQL database ???
Hi all,
When i use the ''delete_all'' function to remove a few rows from my
database, it causes a deadlock on the sql server. The delete seems to be
successful, it then redirects to the ''view'' page, and the record does
appear to be deleted as far as the ''view'' rails page shows.
BUT if i go into sql query analyser, i can''t do a
2007 Jan 23
2
Understanding :dependent => :delete_all?
I can''t see what''s wrong here but that''s probably just because I''m so
new to Rails! To get right into it... I have 4 tables that look like
this:
Sites
- id
Projects
- id
- site_id
- user_id
Tasks
- id
- project_id
- user_id
Users
- id
The corresponding models:
class Site < ARB
has_many :projects, :dependent => :delete_all
end
class Project <
2009 Oct 14
0
[PATCH server] hack betternested set to enable pool deletion
This is an ugly hack to fix the betternestedset plugin as currently
a bug does not allow pools to be deleted. The single line commented
out in this patch deletes the pool itself instead of only its children
for whatever reason.
This wouldn't be a problem were it not for the recent
change to active record which enforces optimistic locking upon
destroy operations. Since the database record is
2007 Jan 25
1
has_and_belongs_to won't delete records
Hi,
I have a has_and_belongs_to relationship between 2 objects, order and
product. I''m getting a foreign key violation when trying to delete
Order. Is there a special way of deleting orders without deleting
products? ("has_many" has :dependant => :delete_all.... does
"has_and_belongs_to" have something similar)
Trying:
Order.delete_all
Getting:
Mysql::Error:
2008 May 28
2
functional testing joins table problem
I have models/controllers
Class Facility
has_many :facilities_services, :dependent => :delete_all
Class Service
has_many :facilities_services, :dependent => :delete_all
Class FacilitiesServices
belongs_to :facility
belongs_to :service
so in my test/functional/facilities_controller_test.rb, I have
post :destroy, :id => 5
which tosses an error...
2006 Jul 10
3
Problem with migrations
I am trying to start my first project after going though the Depot
application in prog prog''s book. For some reason one of my migrations keeps
bombing. I just try to setup a couple tables with some default information
and even with changing the name of the second table and other minor tweaks
it just does not work. I am connected to the db, the first table does get
filled out.
Any help
2006 Sep 03
1
New Technique: Subsets of has_many Associations
I just now thought of this, and sure enough it works like a charm (at
least so far in my limited testing):
has_many :events, :dependent => :delete_all
has_many :upcoming_events, :class_name => "Event", :conditions =>
"date > NOW()"
The purpose of this is that it makes eager loading of subsets of
associations possible without replacing all the magic of the
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8
Very strange , it works in dv mode console , but not in a unit test
class User < ActiveRecord::Base
belongs_to :subdomain
validates_uniqueness_of :email, :scope => :subdomain_id
class UserTest < ActiveSupport::TestCase
def initialize_user
@booboo = FactoryGirl.create(:subdomain, name: "booboo")
@coocoo = FactoryGirl.create(:subdomain, name:
2011 Jul 19
0
Problem with nested form using collection_select and date_select
Hello people
I have a table named Items. Items belongs_to inventory, and Items
belongs_to product.
so items looks like
Item
-id
-inventory_id
-product_id
-date
-comments
The main idea is that I want to create an item while I''m creating the
inventory by using nested form in the inventory form (I already test
creating item with its own methods and forms and works fine), and I
get an
2006 Jul 27
0
CRUD, REST and associations
Let''s say I have the model class Reader and Magazine, connected by join
model Subscription. It looks something like this
class Reader < ActiveRecord::Base
has_many :subscriptions, :dependent => :delete_all
has_many :magazines, :through => :subscriptions
validates_presence_of :name
end
class Magazine < ActiveRecord::Base
has_many :subscriptions, :dependent =>
2006 Nov 04
0
Model.delete_all vs Model.destroy_all in a habtm
Hi there
I have an habtm association between 2 Models.
I regularly have to truncate the table on one side of the relationship
and repopulate the table with a fresh csv file.
I notice that f I do Model.delete_all, none of the records in my habtm
join table get deleted, whereas if I use destroy_all they do.
However, the overhead of using destroy_all is too great. For the
amount of records I have