Displaying 4 results from an estimated 4 matches for "belongstoassociation".
Did you mean:
belongs_to_association
2007 Jun 26
4
Can I stub a method on a belongs_to association:
...ld_receive(:update).with("test_video", :asset_id =>
@assetid, :asset_action => "destroy")
@asset.destroy
end
end
NameError in ''Asset when destroyed should call the delete hook''
undefined method `hook'' for class
`ActiveRecord::Associations::BelongsToAssociation''
I''m not sure why I can''t stub the hook method on the video proxy...I
need to though, because my implementation is
video.hook.update....
Any ideas?
Pat
2008 May 07
1
Assigning to the foreign key on a belongs_to association
.....7135e50 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1094,6 +1094,13 @@ module ActiveRecord
instance_variable_set(ivar, new_value.nil? ? nil :
association)
end
+ if association_proxy_class == BelongsToAssociation
+ define_method("#{reflection.primary_key_name}=") do |
target_id|
+ instance_variable_set(ivar, nil)
+ self["#{reflection.primary_key_name}"] = target_id
+ end
+ end
+
define_method("set_#{reflection.name}...
2007 Feb 24
3
Spec failing [Possible Bug with kind_of? and instance_of?]
I have a spec which is failing, but I just can''t say why. Maybe I''m
missing something painfully obvious?
Here is the pastie of the results & the spec:
http://pastie.caboo.se/42626
The spec to look for is "should have an array of users" I''ve printed
out ("puts''ed") to the terminal the fact that the values are
*opposite* to what
2006 Jul 28
11
Forum
Im making forum and i have problem with paths.
Here is code:
http://pastie.caboo.se/6389
With this code, it works. But its a bit weird to use so many paths
function. For every path i need to make new function. So can you suggest
me something.
Tables are like here:
http://wiki.rubyonrails.com/rails/pages/ForumExample
--
Posted via http://www.ruby-forum.com/.