Displaying 2 results from an estimated 2 matches for "create_has_one_reflection".
2008 Sep 12
1
ArgumentError: Unknown key(s): dependant
...um.find :first
ArgumentError: Unknown key(s): dependant
from
/home/marc/rails_projects/project/vendor/plugins/facebooker/lib/facebooker/rails/helpers.rb:589:in
`assert_valid_keys''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:1187:in
`create_has_one_reflection''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:727:in
`has_one''
from /home/marc/rails_projects/project/app/models/album.rb:2
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:...
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 + '' AND''
cond << " (#{ref.table_name}.deleted_at IS NULL OR
#{ref.table_name}.deleted_at > ''#{Time.now.to_s(:db)}'')"
args.last[:conditi...