Matt Jones wrote:
> 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]>

Thanks, that will help alot.

However as the poster above mentions there is alot to be desired when it 
comes to Ruby/Rails documentation. Like the render method, I too am 
wondering what local_assigns is and how they can be used.

>From the name I assume it is a way to pass local variables to the page 
but that is only an assumption on my part.

Others issues I have is with the ORM framework and the find method. It 
can take a whole bunch of options (like :first and so on) but where are 
all these options listed?
-- 
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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to