similar to: find_by_sql question

Displaying 20 results from an estimated 2000 matches similar to: "find_by_sql question"

2006 Mar 14
2
acts_as_paranoid and :include
Will the find from acts_as_paranoid filter down to an :include? For instance class parent acts_as_paranoid has_many: children end and class child acts_as_paranoid belongs_to :parent end Then if you Parent.find(:all, :include => children) you will get all the children if they are deleted or not. I guess the find that filters out the deleted_at is null does not filter down to the includes
2009 Nov 20
7
Soft Deletes
Hello all, I am wondering how people here are handling soft deletes in Rails. I''ve need a couple of gems/plugins that seem to handle this but from what I gather development has stopped on them. All I need to do right now is mark something as deleted in the DB...nothing fancy. I''m thinking that the simple addition of a deleted_at column, some named scopes (maybe even a default
2008 Apr 15
1
acts_as_paranoid Unknown key(s): with_deleted
Trying this straight from the README: I have acts_as_paranoid in my model (Course), and added the deleted_at column. This is OK: Course.find_with_deleted(:all) Course.find(:all, :with_deleted => true) gives: ArgumentError: Unknown key(s): with_deleted from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/core_ext/hash/keys.rb:49:in `assert_valid_keys''
2007 Jan 08
2
Two problems with Acts_as_paranoid
Hi, I''ve run into two small problems with acts_as_paranoid and wondered if anyone else has experienced them as well (and if yes, if they have any solutions). 1. When using has_many :through, AAP doesn''t seem to take into account the fact that your join model might also be paranoid. My solution to this at the moment is to add an explicit conditions clause to the has_many
2006 Aug 06
5
Return only results that user is allowed to see?
Is it possible with acts_as_ferret to somehow restrict the results that are returned? For instance, I don''t want to return results that are logically deleted with acts_as_paranoid (deleted_at IS NOT NULL and deleted_at < now()). Also, if a user is not an Admin, they should not be able to return results that have a certain value in a certain column, like forum_id != 13 (if 13 is
2006 Mar 02
4
Getting Acts_as_Paranoid to work with validates_uniqueness_of
Hello I''ve been using Acts_as_Parnoid for a while and it has been working well but I am now having a slight issue with it. I have a company table were I would like to use validates_uniqueness_of :company_name. This validation works if a company exists in the database and has not been deleted. However, I also would like the validates_uniqueness_of to work if a company has
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations question here. Using: rails 2.0.2 ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin] mysql 5.0.45 Platform: windows xp The problem: ---------- I created a migration that is designed to add a column named "deleted_at" (timestamp) and then remove a column named "is_deleted" (boolean). The idea is to
2006 Jul 10
0
Strange acts_as_paranoid behavior
Using the acts_as_paranoid plugin with rails 1.1.4 (model also uses acts_as_threaded and acts_as_taggable) and getting some unexplainable behavior. The following tests: assert_equal Conv.count, num assert_equal Conv.count_with_deleted, CONVS_TOTAL Produce the following SQL: SQL (0.000000) SELECT count(*) AS count_all FROM convs WHERE (( convs.deleted_at IS NULL OR convs.deleted_at
2006 Mar 24
6
Should counter_cache fields be saved in the database?
As far as I can tell, the counter_cache option on a belongs_to model doesn''t actually save anything in the database. For example, I have the following models: class Parent < ActiveRecord::Base has_many :children, :conditions => "deleted_at IS NULL" end class Child < ActiveRecord::Base belongs_to :parent, :counter_cache => true end With the following
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following? * For the example with unfortunate disabilities.. look below,,, Usage of has_* (associationmethods) do {def with_deleted AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}... The has_one associations give me a nil object when invoking it with Model.association_OBJECT.with_deleted. Has_many does like
2006 May 11
0
acts_as_paranoid, aliasing and nested scopes in Rails 1.1
I have a real problem with the acts_as_paranoid plugin. The aliasing of find and so the nested scope does not seem to work at all, when combining it with similar plugins. The description: I made a copy of ''acts_as_paranoid'' in the plugin directory, renamed it to ''acts_as_very_new''(just a nonsense plugin for testing), and simplified the code (original code
2013 Jun 15
1
A puzzle about default_scope
Hi, guys I have a puzzle about default_scope. Suppose I have two model: class User < ActiveRecord::Base has_many :blogs default_scope where(deleted_at: nil) end class Blog < ActiveRecord::Base belongs_to :user end I want to produce sqlselect blogs.* from blogs inner join users on users.id = blogs.user_id and users.deleted_at is null And the code Blog.joins(:user), which I think
2008 Feb 12
0
acts_as_paranoid: has_one_paranoid
Hi all, Ran in to a problem with AR::B#find(:include) and acts_as_paranoid, well described here: http://www.ruby-forum.com/topic/57945 So I whipped up this thing, which seems to work for me: module ActiveRecord class Base def self.has_one_paranoid(*args) ref = create_has_one_reflection *args cond = args.last[:conditions] cond = cond.blank? ? '''' : cond
2009 May 27
2
Problem with OCFS2 on RHEL5.0 while installing CRS 10.2.01
Hi team I had installed OCFS2 on RHEL5.0 . every thing looks fine but when I was installing CRS on the node I got error message OCFS2 is not supported. Can you please put some light on this. Please find other info below [root at eregtest1 client]# uname -a Linux eregtest1.admin.abdn.ac.uk 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux i am using RHEL 5.0
2009 May 24
2
accuracy of a neural net
Hi. I started with a file which was a sparse 982x923 matrix and where the last column was a variable to be predicted. I did principle component analysis on it and arrived at a new 982x923 matrix. Then I ran the code below to get a neural network using nnet and then wanted to get a confusion matrix or at least know how accurate the neural net was. I used the first 22 principle components only for
2007 Mar 16
2
re: o2hb_do_disk_heartbeat:963 ERROR: Device "sdb1" another node is heartbeating in our slot!
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Folks, I'm trying to wrap my head around something that happened in our environment. Basically, we noticed the error in /var/log/messages with no other errors. "Mar 16 13:38:02 dbo3 kernel: (3712,3):o2hb_do_disk_heartbeat:963 ERROR: Device "sdb1": another node is heartbeating in our slot!" Usually there are a
2008 Jul 15
1
code reduction (if anyone feels like it)
# I am sure that I could be more efficient than this but how? Thanks in advance. #GPS in Decimal Degrees in the form longitude latitude RM215 <- matrix(c(-82.1461363, 33.5959109), nrow=1) SC <- matrix(c(-82.025888, 33.606454), nrow=1) RM202 <- matrix(c(-81.9906723, 33.5027653), nrow=1) RM198 <- matrix(c(-81.926823, 33.4634678), nrow=1) HC <- matrix(c(-81.920505, 33.46192), nrow=1)
2012 Dec 19
1
[PATCH] x86: also print CRn register values upon double fault
Do so by simply re-using _show_registers(). Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -225,6 +225,7 @@ void double_fault(void); void do_double_fault(struct cpu_user_regs *regs) { unsigned int cpu; + unsigned long crs[8]; watchdog_disable(); @@ -235,22 +236,18 @@ void do_double_fault(struct
2016 Jul 20
4
un solo un favor
Hola a todos Esta es mi primera pregunta en el grupo, y es sencilla pero me tiene atascado. Estoy tratando de cortar mi mapa de (poner limites en UTM) en un lugar definido como mi area de estudio (en este caso el sur de chile). Pero creo no estar usando bien la funciĆ³n CRS ponendo bien los limites requeridos. > study_area <- readRDS("CHL_adm0.rds") > study_area_UTM <-
2007 Jan 17
1
sp: proj4string has no impact
Hi all, I'm faced with a problem applying the sp package: The projection argument in readShapePoly(Shapefile,proj4string="CRS class argument") e.g.: CRS("+proj=aea +lat_1=46 +lat_2=73 +lat_0=60 +lon_0=84 +x_0=0 +y_0=0 +ellps=clrk66 +units=m +no_defs") doesn't have any impact on the plotted object. I also tested the simple example: xy = cbind(x = 2 * runif(100) -