The API ref at api.rubyonrails.org is the main source, but reading it sometimes requires a little more understanding.
The object passed to form_for's block is an instance of ActionView::Helpers::FormBuilder. There's not explicit documentation for it, as most of it's methods are metaprogrammed versions of the methods in ActionView::Helpers::FormHelper. FormBuilder's methods are essentially partially applied versions of FormHelper's, in that they don't require the first argument. Thus, the middle statement here: <% form_for 'thing' do |form| %> <%= form.text_field :name %> <% end %> is identical to: <%= text_field 'thing', :name %> It's a handy shorthand, and also makes some things (rendering fields in a partial, for instance) much easier. Going forward, there are a couple things that will help you figure out what's going on: - object.inspect will typically get you a short string representation of an object; some objects may not show all fields here, but at least the type will be visible - object.debug (in a view) will output a YAML version of the given object, wrapped in 'pre' tags. This can be useful for debugging models, for instance. - if all else fails, install ruby-debug and put 'debugger' wherever needed. You can even use it inside of ERB views! Hope this helps. --Matt Jones On Jul 14, 5:25 am, Shahin Kordasti <[email protected]> wrote: > > Thanks for the info and I got that book you mentioned. However I wanted > an easily available api doc (like Suns javadoc) where I could find this > "form" parameter (and others like it) and what fields are available. For > example you mention form.text_field, form.text_area. What others are > there and are they listed anywhere? > -- > Posted viahttp://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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

