Displaying 5 results from an estimated 5 matches for "to_ary".
Did you mean:
hoary
2010 Aug 22
7
Rails 3: Error saving an object with no useful information
Hey,
I''m kinda desperate cause I''m getting an error and have no idea how to
fix this since it doesn''t give me any information hinting where the
problem is:
irb(main):054:0> reload!;User.last.save!
Reloading...
NameError: undefined local variable or method `to_ary'' for
#<User:0x4ed5d20>
from
D:/ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.0.rc/lib/active_model/attribute_methods.rb:364:in
`method_missing''
from
D:/ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/attribute_methods.rb:46:in
`met...
2011 Apr 10
0
Rendering collections
When you render a partial with a collection, rendering silently fails
if the collection object doesn''t respond to #to_ary. This means that a
class that mixes in Enumerable won''t work, unless you also add a
to_ary method. A couple of issues of thoughts regarding this:
1) Failing silently is probably not the best thing to do, especially
since this behavior isn''t documented anywhere.
2) Is relying on...
2006 Mar 08
4
order.products << product w/out persisting
Hi,
I have a one-to-many relationship. I want to be able to add objects
to the collection w/out persisting them. How do I do this?
The only thing I can''t think of is to use a transaction and roll it back.
In other words - I want to do this:
o = Order.find(1)
p = Product.find(1)
o.products << p # but don''t persist this
I assume I''m just missing something
2009 Jan 21
1
AR to_xml problem with associations, Builder::XmlMarkup#to_a
When I do a to_xml(with a block) on an association of a model I got a
Builder::XmlMarkup#to_ary should return Array
Example that does not work.
@intervenant = Intervenant.find(params[:id])
output = @intervenant.to_xml( :skip_types => false, :dasherize =>
false) do |xml|
@intervenant.individu.to_xml( :builder => xml, :skip_instruct =>
true, :skip_types => false,...
2010 Sep 14
0
Model with method_missing - rails 3, ruby 1.9.2 raises exception
Say you have two models Post and Author.
And Post has_many :authors
Finally, method_missing is overridden in Author.
Then if you do
Post.limit(1).first << Author.limit(1).first
You get an exception Author does not define :to_ary
Or has there been a change in rails 3 that I have completely
overlooked while migrating my app?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscri...