similar to: ActiveRecord delete_all With Sanitized Parameters?

Displaying 20 results from an estimated 8000 matches similar to: "ActiveRecord delete_all With Sanitized Parameters?"

2006 Jan 11
17
Different Types of Users and User Engine
My question is how have people implemented different types of users in their Web applications using user-engine? As for my application, I use single table inheritance in order to derive several different types of users, such as "moderators," "editors," etc ... For example, let''s say that I want to create a moderator. I define a new moderator class and Controller like
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 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
2006 Jan 10
13
# of entrys in different months
right now im writing a weblog as my first project in rails. Most tings seems to be working great :), but there is (a least) one thing left i can''t figure out how to do. As most weblogs i would like to have an archive, whick looks like this: January 2006 (42) December 2005 (60) November 2005 (2) October 2005 (101) September 2005 (4) August 2005 (2) July 2005 (101010) where (x) is the
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 <
2006 Jan 03
5
Announcement: Indexed Search Engine 0.1.2 Available
Hello all. Apologies... I was a little too eager in my earlier annoucement about the Indexed Search Engine for Rails apps. The DB migration file contained an error that had to be worked around. I''ve fixed that, added more (and clearer) documentation, and a sample application. You can find most everything you want to know about Indexed Search Engine here:
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 Jan 16
5
Soft Deletes
How would I go about setting up my rails applications to soft delete items from the database rather than actually deleting it. I would imagine that I need to over ride the methods from ActiveRecord. Where would I do this would it be in the model? enviroment.rb? I would imagine that if i wanted it throughout my entire application it would need to be in the enviroment.rb. Also to
2006 Jan 22
7
: Indexed Search Engine 0.1.3 Released
Hello all, IndexedSearch Engine for Rails Engines version 0.1.3 has been released. IndexedSearch is a simple, pluggable engine for rails applications which can be used to enable full text indexed searches within an application. Searchable data is parsed, stemmed using the Porter stemmer, and added to a fully indexed table. This allows you to index things like "he runs fast" which will
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
2006 Jan 03
3
render :partial stops setting local variables.
I''m not sure what happened, or what change has caused this to happen, but render :partial (or any render for that matter, doesn''t seem to let me set local variables via the local_assigns argument hash. for example <%= render :partial ''edit'', :username => @user.username %> used to allow that username was a local variable in my _edit.rhtml partial
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...
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:
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this: divisions has_many groups groups belongs_to division has_many subgroups subgroups belongs_to group has_many units units belongs_to subgroup I have a report which is based on units, but i want to be able to filter the units by which subgroup, or which group, or which division. I also want to sort them by division.name,then group.name,
2006 Jul 15
12
Safe way to destroy records
Hello, how can I check if a destroy was successful? Is the object only frozen if deleted or do I have to do an additional find to see if there is a record left? What happens if an after_destroy callback returns false? Is there always a rollback? Markus
2006 Jun 15
8
postgresql sequence and migrations
I have a specific need to ''fixate'' my ''roles'' table sequence when migrating. at migration #4, I have 28 records in my roles tables and I can manually reset the roles_id_seq but it stands to reason that since I am doing everything else in the migration, I might as well reset the sequence there too. so I tried this in my migration file... execute
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi I noticed that if in my code I use the following: Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})") All my objects are properly updated but none of the filters/callbacks are triggered. Is that what''s expected? I have a before_update filter set on the Photo class and it gets totally ignored, I guess the only way to solve this
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: