Rails Framework Documentation - More Info, Please

Hey all,

I try to ask intelligent question about Ruby on Rails, and only after I
search for the answers myself. Recently, I’ve hit a frustrating bump on
the learning curve and it seems really stupid.

I’m making a user system, and working on the update method. When I
create the form in the same manner as taught in Agile Development with
Rails and a number of other tutorials (assign an object in the
controler, and then use FormHelper methods to create the form in the
view) I run into issues with the password field. I hash all the
passwords, and they’re inputted by default into the passsword field. I
want this field to be blank, like the password_confirmation field is,
but I don’t know how.

So I looked at the rails documentation, and the password helper works
just like the text_field helper… okay, so I look at the documentation
for THAT, and here is where the problem is, and I’ve seen this a number
of times before.

When I look at the documentation (reference:
ActionView::Helpers::FormHelper),
I look at text_field at the very bottom. It lists as parameters three
things. I figure that the solution to my problem is by passing an
option in the options hash. But I don’t know the syntax and don’t want
to guess at it. Tell me how, generally, to find a list of available
options for a function – I can’t seem to figure it out. This would
help me a number of different times, because I run into this issue quite
often.

Yeah, its frustrating. Some parts of the API are well documented and
some, like the FormHelper methods, stink. The forum is a good place to
search if the API doesn’t answer your question. Also, GUESSING can work
well too. For example, :value => “blah” will set the default value in a
text field but is not documented anywhere as far as I can see. Same
with :style => (css stuff here)

Hey Brian, if you take another look at the AWDwRv2, it provides the
answer for you on page 484 of the PDF. You may also see usage on page
162 as well. Next, are you attempting to edit the password field? I
believe this is the case. Then you’ll need to do the following:

:value => “”

Note: The option that you use for the password_field would be very
similar to the options that you would use within HTML.

Good luck,

-Conrad

Hey Brian, it’s OK to experiment.

-Conrad

The best next step seems to be Ruby for Rails and/or something like
Rails Recipes or Ruby/Rails Cookbook. I found these resources to be
excellent ways to deepen my understanding of Ruby and Rails while also
picking up some interesting, time saving tricks.

–Jeremy

Taylor and Conrad,

Thanks for the help. I did end up finding the documentation in AWDwRv2
(had to think for a moment what you were talking about with the
acronym!) My specific problem, however, illustrated a common problem
I’ve experienced with the documentation a number of times… It feels
stinky that in order to get full documentation on an open source
product, I would have to purchase a book authored by someone
intrinsically involved in the creation of Rails. I’d purchase the book
anyway because documentation doesn’t give you a “How to get started”
(generally), and I don’t mind the person making money… anyway,
enough with a rant of frustration.

One more question:

What books go more in-depth than AWDwRv2? I’d like to learn a lot more
about the object structure, etc. and can see doing this with the docs,
but not all of it.

Conrad T. wrote:

Hey Brian, if you take another look at the AWDwRv2, it provides the
answer for you on page 484 of the PDF. You may also see usage on page
162 as well. Next, are you attempting to edit the password field? I
believe this is the case. Then you’ll need to do the following:

:value => “”

Note: The option that you use for the password_field would be very
similar to the options that you would use within HTML.

Good luck,

-Conrad

I don’t know why I wrote “David” when I meant “Bryan.”

Reading “Ruby For Rails” will help you understand why some of the things
in
Rails work the way they do. It’s a very worthwhile read.

David,

I’ve gone from zero programming skill to being able to roll web apps and
actually improvise code with less than $200 invested in books. Not a
bad deal, IMO. Here are some suggestions:

Programming Ruby - a reference book for all the Ruby functions
Ruby for Rails - good Ruby and OOP background
The Ruby Way - a million examples of how to do things with Ruby
Ruby/Rails Cookbook - great Rails examples

But really only AWDwR goes into how RAILS works.