Displaying 20 results from an estimated 10000 matches similar to: "Soft Deletes"
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
2006 Jan 31
2
find_by_sql question
I''m no good at SQL and I have a question that will hopefully be fairly
easy to answer.
I''m using acts_as_paranoid which instead of deleting a record adds a
deleted_at column with the datetime the row was deleted. I want to have
a find_by_sql filter out any row where deleted_at is not null.
I have (at least the relevant parts):
#a couple working filters here.
filters <<
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
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''
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
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
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
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
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 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
2007 May 11
3
is_active?
Hey all, i''m rather new to rails and was curious if ActiveRecord
implemented anything like is_active where the delete functions would
just mark records as inactive, vs deleting rows. (similar to created_at,
etc). I need a history of transactions, and this is how I would code in
other languages. Any advice? Is there are smarter way to implement this?
Thanks in advance!
--
Posted via
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
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
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
2006 May 18
5
Overriding default DELETE behavior with logical deletes
Hello!
I am trying to figure out how to implement *logical deletes* instead of
physical deletes using ActiveRecord. Basically, in many applications
that deal with E-Commerce, you really can''t physically delete almost
anything, because records must be kept for auditing and customer service
tracking purposes.
In the past, I''ve implemented logical deletes as follows:
1.
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
2010 Jan 04
3
Generate PDF
Hi !
I need to create some pdf from my application. I have a table people
with a field address and I need to generate a pdf of label of each
address ( I think 10 labels per page). The pdf can have around 500
pages.
Which library should I use to do it ? I read some information about
different library to generate pdf but I don''t know if all library are
a good choice for generate
2010 Jun 21
14
Controllers, what? why?
Hi,
I am starting to learn rails and I went through the guide and a couple
of tutorials. Even though I understand controllers or at least I can
use them I can''t see yet the whole picture.
Why do you need several controllers for a single application? If a
controller is just a class whose methods interface with models and
views, why not have a single controller for the whole application?
2008 Oct 14
1
Starting Server gives an error
Hi,
I had created a new environment and tried to start the webrick server
for that environment but it is giving an error:-
E:/demo/vendor/rails/railties/lib/commands/servers/
webrick.rb:11: warning: already initialized constant OPTIONS
E:/demo/vendor/rails/activesupport/lib/active_suppo
rt/dependencies.rb:249:in `load_missing_constant'': Expected E:/Demo