Both ActionView::Helpers::FormBuilder#object() and 
ActiveRecord::Persistence#new_record?() exist in rails 3.  Here is how 
"Ruby on Rails 3 Tutorial" uses them:


<%= form_for(@user) do |f| %>

  <%= render 'some/partial', :object => f.object %>

Then a local variable named 'object' is available in the partial and it
is equal to @user (at least that is the way things appear to work).


class User < ActiveRecordBase

  ...
  ...
  def some_action
    if new_record?
       #do something
    end
  end


> and rails 3 seems angry about the
> fields_for that defines person_form in Rails 2

You should post your code.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to