# Rails API is not well defined

**URL:** <https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819>\
**Category:** Rails\
**Created:** [May 22, 2007, 9:48pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819 "2007-05-22T21:48:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mario\_TSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Post date:** [May 22, 2007, 9:48pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819/1 "2007-05-22T21:48:12Z")

</div>

Although somewhat new, I continue to struggle with passing the right  
parameters to the Rails methods despite making direct reference to the  
documentation. For example, I want to create a form:

form\_tag :action =\> ‘deliver’, :id =\> @event.id, :class =\> ‘entry’

The class doesn’t show up. I’ve tried various combinations of hash  
braces. Also, what if I want to pass in an id for the form tag itself  
(e.g. #myentryform).

This is a little frustrating. Has anyone else experienced this? What  
got you past this hurdle?

Mario

---

<div class="post-metadata">

**Author:** ![Mario\_TSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Post date:** [May 22, 2007, 9:58pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819/2 "2007-05-22T21:58:27Z")

</div>

On 5/22/07, Mario T. Lanza [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This is a little frustrating. Has anyone else experienced this? What  
> got you past this hurdle?

You have to establish when your first hash of parameters ends,  
otherwise form\_tag will assume your :action, :id, and :class options  
are a single hash, when :class really needs to go in a separate hash.

This might help explain a bit more:

[http://destiney.com/blog/rails-form-tag](http://destiney.com/blog/rails-form-tag)

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![Mario\_TSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Post date:** [May 22, 2007, 10:04pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819/3 "2007-05-22T22:04:27Z")

</div>

Mario,

Consider this:

\<%=start\_form\_tag({ :action=\> ‘quick\_create’, :upload\_id =\> @upid },  
{  
:id =\> ‘quick\_campaign\_form’, :multipart =\> true})%\>

You would put :class in the 2nd hash (eg. after :multipart). Otherwise,  
:class goes into the url\_for method and I think is used as a param in  
the  
form post/get.

---

<div class="post-metadata">

**Author:** ![Mario\_TSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Post date:** [May 27, 2007, 2:01pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819/4 "2007-05-27T14:01:02Z")

</div>

Hi,

I had the same problem for a long time. I would study the helper  
methods, but just couldnt get my head around it all. It seemed so  
vague. But the penny has just about dropped. I think understanding  
the Agile Rails chapters on form and field tags has helped. But just  
getting used to dealing with database results as models and feeling  
comfortable with the terminology took time. Now it starts to seem  
obvious. I guess the problem is that some of the Rails ‘Automagic’  
can initially tend to be ‘Automysteryerious’ .

tonypm

On May 22, 10:29 pm, “Mario T. Lanza” \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![Mario\_TSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Post date:** [May 22, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/rails-api-is-not-well-defined/104819/5 "2007-05-22T23:29:50Z")

</div>

Thanks, guys. After a few attempts I eventually did get it working,  
it’s just that often even with the help of the online RDoc it’s not  
clear. I’m sure I’ll get better. 🙂  
Mario
