Forum: Ruby on Rails undefined method `symbol_path'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Neubyr N. (Guest)
on 2009-03-09 02:17
I am getting following error while creating a new topic using RESTful
design. But, everything works fine when I use <% form_tag :action =>
:create do %> .

ActionView::TemplateError (undefined method `symbol_path' for
#<ActionView::Base:0xb72a2e40>) on line #3 of topics/new.rhtml:
1: <h1>New Topic</h1>
2:
3: <% form_tag :topic, :url => topics_path do %>
4:   <%= render :partial => 'topic_form', :object => @topic %>
5:   <%= check_box_tag :make_standard, :true, @standard%>
6:   &nbsp;Fill with standard items<br /><br />

Any clues?

CS.

Please someone help me with this... My previous posts have also received
no response. :(
Frederick C. (Guest)
on 2009-03-09 02:53
(Received via mailing list)
On Mar 9, 12:17 am, Carlos S. <removed_email_address@domain.invalid>
wrote:
> I am getting following error while creating a new topic using RESTful
> design. But, everything works fine when I use <% form_tag :action =>
> :create do %> .
>

> ActionView::TemplateError (undefined method `symbol_path' for
> #<ActionView::Base:0xb72a2e40>) on line #3 of topics/new.rhtml:
> 1: <h1>New Topic</h1>
> 2:
> 3: <% form_tag :topic, :url => topics_path do %>

form_tag doesn't work like that - the first argument has to be a hash
of routing options or a path. Looks like you were actually trying to
use form_for (or you just wanted form_tag topics_path)

Fred
Neubyr N. (Guest)
on 2009-03-09 03:24
Thanks Fred...

I referred to
http://ueckerman.net/2007/04/24/the-basics-of-rest-in-rails/ .

Your suggestion worked for creating topic. However, I have nested
resource as topic has_many items. When I use similar form_tag method in
my items, I am getting " undefined local variable or method `items_path'
for #<ActionView::Base:0xb71c205c>" error.
Please see: http://www.ruby-forum.com/topic/180779
I tried it with <% form_tag items_path do %>.

Also if someone could help me in my self-referential associations and
REST topic that would be of really great help.

Thanks,
CS.

Frederick C. wrote:
> On Mar 9, 12:17�am, Carlos S. <removed_email_address@domain.invalid>
> wrote:
>> I am getting following error while creating a new topic using RESTful
>> design. But, everything works fine when I use <% form_tag :action =>
>> :create do %> .
>>
>
>> ActionView::TemplateError (undefined method `symbol_path' for
>> #<ActionView::Base:0xb72a2e40>) on line #3 of topics/new.rhtml:
>> 1: <h1>New Topic</h1>
>> 2:
>> 3: <% form_tag :topic, :url => topics_path do %>
>
> form_tag doesn't work like that - the first argument has to be a hash
> of routing options or a path. Looks like you were actually trying to
> use form_for (or you just wanted form_tag topics_path)
>
> Fred
Frederick C. (Guest)
on 2009-03-09 11:26
(Received via mailing list)
On Mar 9, 1:24 am, Carlos S. <removed_email_address@domain.invalid>
wrote:
> Thanks Fred...
>
> I referred tohttp://ueckerman.net/2007/04/24/the-basics-of-rest-in-rails/.
>
> Your suggestion worked for creating topic. However, I have nested
> resource as topic has_many items. When I use similar form_tag method in
> my items, I am getting " undefined local variable or method `items_path'
> for #<ActionView::Base:0xb71c205c>" error.

that just sounds like your routes.rb is not in sync with what you're
trying to do (since it's from there that the helper methods items_path
and so on are created). You might find
http://guides.rubyonrails.org/routing.html
useful

Fred
Neubyr N. (Guest)
on 2009-03-09 16:23
Figured it out..
It is just <%= agenda_item_url() do %>

However, I am not able to pass agenda_id and item_id to this create
method in my controller.


Frederick C. wrote:
> On Mar 9, 1:24�am, Carlos S. <removed_email_address@domain.invalid>
> wrote:
>> Thanks Fred...
>>
>> I referred tohttp://ueckerman.net/2007/04/24/the-basics-of-rest-in-rails/.
>>
>> Your suggestion worked for creating topic. However, I have nested
>> resource as topic has_many items. When I use similar form_tag method in
>> my items, I am getting " undefined local variable or method `items_path'
>> for #<ActionView::Base:0xb71c205c>" error.
>
> that just sounds like your routes.rb is not in sync with what you're
> trying to do (since it's from there that the helper methods items_path
> and so on are created). You might find
> http://guides.rubyonrails.org/routing.html
> useful
>
> Fred
This topic is locked and can not be replied to.