I have this:
<%-f.fields_for(:clearances, :index => []) do |ff|
puts ff.object.methods.sort
if ff.object.newrecord?
ff_id = "new_"
else
ff_id = "show_"
end
-%>
Which gives me this:
. . .
metaclass
method
method_missing
methods
nested_attributes_options
new_record?
nil?
object_id
partial_updates
. . .
And we follow the new user roles
link # features/app/models/
clearances/step_definitions/clearance_steps.rb:14
undefined method `newrecord?'' for
#<Clearance:0x2b203e415238>
(ActionView::TemplateError)
So, where does the missing method go between the puts and the if?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
byrnejb
2010-Jan-28 17:51 UTC
Re: fields_for object methods - no you see them, now you don''t
On Jan 28, 12:47 pm, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote:> And we follow the new user roles > link # features/app/models/ > clearances/step_definitions/clearance_steps.rb:14 > undefined method `newrecord?'' for #<Clearance:0x2b203e415238> > (ActionView::TemplateError) > > So, where does the missing method go between the puts and the if?Never mind. I see my error. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2010-Jan-28 17:52 UTC
Re: fields_for object methods - no you see them, now you don''t
On Jan 28, 2010, at 9:47 AM, byrnejb wrote:> I have this: > > <%-f.fields_for(:clearances, :index => []) do |ff| > > puts ff.object.methods.sort > if ff.object.newrecord? > ff_id = "new_" > else > ff_id = "show_" > end > > -%> > > Which gives me this: > > . . . > metaclass > method > method_missing > methods > nested_attributes_options > new_record? > nil? > object_id > partial_updates > . . . > > And we follow the new user roles > link # features/app/models/ > clearances/step_definitions/clearance_steps.rb:14 > undefined method `newrecord?'' for #<Clearance:0x2b203e415238> > (ActionView::TemplateError) > > > So, where does the missing method go between the puts and the if?newrecord? vs new_record? you''re missing an underscore in your code. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Jan-28 17:53 UTC
Re: Re: fields_for object methods - no you see them, now you don''t
On 28 January 2010 17:51, byrnejb <byrnejb-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote:> > > On Jan 28, 12:47 pm, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote: > >> And we follow the new user roles >> link # features/app/models/ >> clearances/step_definitions/clearance_steps.rb:14 >> undefined method `newrecord?'' for #<Clearance:0x2b203e415238> >> (ActionView::TemplateError) >> >> So, where does the missing method go between the puts and the if? > > Never mind. I see my error.Which was? We all like to learn from questions here. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
byrnejb
2010-Jan-28 21:49 UTC
Re: fields_for object methods - no you see them, now you don''t
On Jan 28, 12:53 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 28 January 2010 17:51, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote: > > > > > On Jan 28, 12:47 pm, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote: > > >> And we follow the new user roles > >> link # features/app/models/ > >> clearances/step_definitions/clearance_steps.rb:14 > >> undefined method `newrecord?'' for #<Clearance:0x2b203e415238> > >> (ActionView::TemplateError) > > >> So, where does the missing method go between the puts and the if? > > > Never mind. I see my error. > > Which was? We all like to learn from questions here. > > Colinnewrecord? should be new_record? instead. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.