similar to: Speeding up :dependent => :destroy

Displaying 20 results from an estimated 1000 matches similar to: "Speeding up :dependent => :destroy"

2006 Mar 13
6
:dependent => :destroy
Hi, There is something I don''t understand about :dependent => :destroy. I hope someone can help me. Consider this code: class Folder < ActiveRecord::Base has_many :myfiles has_many :folders has_many :group_folders, :dependent => :destroy validates_uniqueness_of :name, :scope => "folder_id" validates_presence_of :name before_destroy
2006 Feb 18
5
don''t destroy last user
How would I stop the last user being deleted. The following code doesn''t work. before_destroy :dont_destroy_last_user # Don''t delete user if it the last one def dont_destroy_last_User raise "Can''t destroy last user" if User.length < 1 end -- Posted via http://www.ruby-forum.com/.
2005 May 08
1
"validation" on destroy
I''m building a little application with Rails, and I''m becoming a huge fan of the validations in ActiveRecord. Recently, though I ran into a problem which to me feels like a job for Validations, but I can''t see a way to use them. My model consits of a Trade object, which represents either buying or selling some security. I need to require that at no point has a user
2006 Mar 24
2
before_destroy not called
Hello, I''m trying to intercept delete call in my model but before_destroy callback is never called... Somebody knows why ? Thanks The controller : def delete Image.delete(params[:id]) redirect_to :action => "list" end The model : class Image < ActiveRecord::Base set_table_name "publish_images" belongs_to :article before_destroy :on_destroy
2007 Mar 14
0
before_destroy return false, but dependent are destroyed
I have a problem with before_destroy deleting by dependent records, even through I return flase. ... has_many :users, :class_name => ''Editor'', :as => :editable, :dependent => :destroy ... def before_destroy unless self.has_access?(99) errors.add_to_base "Destroy permissions error!" return false end end When I remove the dependent
2006 Dec 07
2
validate_on_destroy ?
What''s the best way to validate_on_destroy. Rails only seems to include validate_on_create and validate_on_update methods. I don''t want to resort to doing: before_destroy do |j| raise "There is an error" if j.etc end Is there a way of finding out what action (create/update/destroy) is being performed if I use the ''validate'' method? -- Posted via
2006 Aug 01
3
Validation on ActiveRecord destruction
Rails has many built in validation methods to ensure that an ActiveRecord instance cannot be created or updated under certain situations (typically caused by invalid data). However, I can find no methods to govern whether an ActiveRecord instance can be destroyed. Essentially, I wish an error to be raised when a user tries to delete an ActiveRecord without first adhering to a certain set of
2008 Jul 02
2
How to write the method before_destroy and the test
How to write the method before_destroy? Here is my code: def before_destroy errors.add(:isdefault,"Can''t destroy default record") if self.isdefault return false end or I should write it like below? def before_destroy raise(Can''t destroy default record") if self.isdefault end and how to write the test for it -- Posted via
2000 Nov 30
1
glossary?
hi; i'm a lurker & trying to make sense of the discussion... is there a glossary of terms available somewhere? mdct, wavelets, 4th dimensions & preechoes remind me of my time in the twilight zone;) thanks peter --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to
2009 Apr 02
3
error_messages_for does not display the error
Hi all I''ve approached Rails since a couple of months to develop a quick application for my company. Fantastic framework. As every noob, I do have some gaps to cover. The one which is giving me a little frustration, generated by my lack of knowledge is as follows. I need to make sure the region object is not deleted if there are countries associated with it. I solved this by putting a
2005 Oct 23
12
Showing a neat error message
Hi All, I''m trying to prevent users from deleting a folder that has contents like this: class Folder < ActiveRecord::Base has_many :myfiles has_many :folders belongs_to :folder validates_uniqueness_of :name, :scope => "folder_id" before_destroy :dont_destroy_folder_with_contents def dont_destroy_folder_with_contents if Folder.find(id) != nil ||
2009 Dec 30
3
Mail now in ActionMailer
OK everyone, so we finally have Mail merged into ActionMailer replacing out TMail This is for the 3.0 release, and not part of the 2.x tree. I am the TMail maintainer and I decided this year to write a ruby email handler, the Mail gem is my solution to this. Mail takes a very object oriented approach to email. It conforms to RFCs as closely as practical and parses the 0.5gb Trec and 2.5Gb
2009 Dec 30
3
Mail now in ActionMailer
OK everyone, so we finally have Mail merged into ActionMailer replacing out TMail This is for the 3.0 release, and not part of the 2.x tree. I am the TMail maintainer and I decided this year to write a ruby email handler, the Mail gem is my solution to this. Mail takes a very object oriented approach to email. It conforms to RFCs as closely as practical and parses the 0.5gb Trec and 2.5Gb
2007 Jul 18
10
Rails - Mock going out of scope?
Hello list, I think I have a rails related RSpec problem with a mock going out of scope on a recursive call to a model. The code is at: http://pastie.textmate.org/79821 if you want to see it highlighted. I have pasted it below as well. Basically, I have an acts_as_nested_set model called "Node", which works fine. I have a function which finds the language name of the node instance.
2012 Oct 13
4
Database design, working but looking for better ways
Rails 3.1.3 Hi. I have designed the database used for my travel plan application. You should be able to look at the diagram in the link below, hopefully. https://cacoo.com/diagrams/biDSyxh8yzk2kIeg ("belongs_to" is omitted since it''s obvious) Basically, the application can list the destinations from a choice of the departure. Not mention that the departure_id (integer) and
2006 Jul 04
1
select(object, method, choices, options = {}, html_options = {})
Hi, I''m using: select(object, method, choices, options = {}, html_options = {}) I''ve read the API where there''s this example: select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) should give this code: <select name="post[person_id]"> <option></option>
2004 Aug 23
2
Hold the phone!
Just a little pun there! I've been mostly lurking for a couple of weeks and realize how little I know and understand about this PBX and phone stuff. I did a little looking about and came across a glossary but they terms are -- for me -- kind of out of context. I'm wondering if there is (much as I hate the term "Dummy") a "PBX for Dummy's" or similar. I've
2013 Aug 27
2
What does collection_freq means?
Hi, all: I am confused with the concept of colletion_freq There's no informations about it on http://xapian.org/docs/glossary.html What does it means? Thanks Regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20130827/370cc6a3/attachment.html>
2009 May 14
1
*ERROR: BUILD FAILED! Banned tag found*
Error building ovirt-doc in master branch. make[4]: Map '/root/rpmbuild/BUILD/ovirt-docs-0.98/Using_the_oVirt_Admin_UI' wordt binnengegaan Processing, Product: oVirt_Server_Suite, Version: 0, Edition: 0.95, Release: 2 START: xml-en-US do mei 14 22:56:19 CEST 2009 copying oVirt/en-US Common_Content cleaning files Appendix-B.xml Appendix.xml Author_Group.xml
2009 May 27
3
Call in progress tones
Hello all, I've played with background and play sounds apps and googled around and asked the list before to no avail. Does anyone know of a way to have tones played during the call progress stage of the call? We (especially on some international circuits) get up to 5 seconds of silence before the phone starts ringing or is busy. I don't want to force "R" on the Dial app as