Fields_for object methods - no you see them, now you don't

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?

On Jan 28, 12:47 pm, byrnejb [email protected] 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.

On Jan 28, 2010, at 9:47 AM, byrnejb wrote:

new_record?

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.

On 28 January 2010 17:51, byrnejb [email protected] wrote:

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

On Jan 28, 12:53 pm, Colin L. [email protected] wrote:

(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

newrecord? should be new_record? instead.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs