Forms in partials

0 views
Skip to first unread message

Ed Jones

unread,
Jan 5, 2010, 2:25:12 PM1/5/10
to Columbus Ruby Brigade
Help, my form has fallen and it won't get up.

I have a page in which a form works just fine--in the main page. If I
extract it to a partial, the same code calls not the desired add_items
method, but a remove_items method.

Indeed, Firebug tells me that my form tag is just not rendered when
its moved to a partial.

What's happening?

The partial is:
<% form_tag(my_digi_add_my_game_path(@my_game)) do %>
<table>
...
</table>
<%= submit_tag "include" %>
<% end %>

Ryan Briones

unread,
Jan 5, 2010, 2:43:12 PM1/5/10
to colum...@googlegroups.com
The only thing "weird" I see is that you shouldn't be accessing instance variables from within your partial. Pass it in as a local if you need access to it. It's possible that Rails enforces this explicitly now, I don't know.

--
You received this message because you are subscribed to the Google Groups "Columbus Ruby Brigade" group.
To post to this group, send email to colum...@googlegroups.com.
To unsubscribe from this group, send email to columbusrb+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/columbusrb?hl=en.






--
Ryan Carmelo Briones

Ed Jones

unread,
Jan 5, 2010, 10:29:36 PM1/5/10
to Columbus Ruby Brigade
A voice from the west!! How's the Windy City this frigid day Ryan?

OK, the problem was that a previous form_tag wouldn't produce a closed
form. Thus the second form_tag (via the partial) generated a form in a
form. Surrounding it with div's somehow solved it, I don't know why.

Thanks for larnin me about locals though. Good to know,

e

On Jan 5, 2:43 pm, Ryan Briones <ryan.brio...@brionesandco.com> wrote:
> The only thing "weird" I see is that you shouldn't be accessing instance
> variables from within your partial. Pass it in as a local if you need access
> to it. It's possible that Rails enforces this explicitly now, I don't know.
>
>
>
> On Tue, Jan 5, 2010 at 1:25 PM, Ed Jones <ed.jo...@gmail.com> wrote:
> > Help, my form has fallen and it won't get up.
>
> > I have a page in which a form works just fine--in the main page. If I
> > extract it to a partial, the same code calls not the desired add_items
> > method, but a remove_items method.
>
> > Indeed, Firebug tells me that my form tag is just not rendered when
> > its moved to a partial.
>
> > What's happening?
>
> > The partial is:
> > <% form_tag(my_digi_add_my_game_path(@my_game)) do %>
> >  <table>
> > ...
> >  </table>
> > <%= submit_tag "include" %>
> > <% end %>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Columbus Ruby Brigade" group.
> > To post to this group, send email to colum...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > columbusrb+...@googlegroups.com<columbusrb%2Bunsu...@googlegroups.com>

Mike Busch

unread,
Jan 6, 2010, 10:41:45 AM1/6/10
to Columbus Ruby Brigade
@Ed

Is the first form closed with an <% end %>? I would assume that
correcting that issue would make the extra div unnecessary. It would
also eliminate the possibility of different browsers handling the HTML
error differently. Good Luck

-Mike

Ryan Briones

unread,
Jan 6, 2010, 11:22:58 AM1/6/10
to colum...@googlegroups.com
It is definitely frigid! Loving Chicago. Glad I could help in some way. :)

To unsubscribe from this group, send email to columbusrb+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/columbusrb?hl=en.






--
Ryan Carmelo Briones

Ed Jones

unread,
Jan 6, 2010, 2:45:03 PM1/6/10
to Columbus Ruby Brigade
Yep, Mike, it had its <% end %>. Tried moving the ends around, adding
one just in case, deleting one just in case.

Ryan: Glad u like Chicago. And the Cubs haven't even played!!

e

Reply all
Reply to author
Forward
0 new messages