Well right now i''m currently trying to make a form that posts
information into my database. I''m using the form_for function, but
when i run the server and go to the page and get this error:
undefined method `posts_path'' for #<ActionView::Base:0x23bbabc>
So i have no idea what i''m doing wrong, here is the code for the form:
<% form_for(@posts) do |p| %>
<%= p.error_message %>
<p>
<%= p.label :title %><br />
<%= p.text_field :title %>
</p>
<p>
<%= p.label :post %><br />
<%= p.text_area :post %>
</p>
<p>
<%= p.submit "Submit Post" %>
</p>
<% end %>
Any idea?
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Zack K. wrote:> Well right now i''m currently trying to make a form that posts > information into my database. I''m using the form_for function, but > when i run the server and go to the page and get this error: > > undefined method `posts_path'' for #<ActionView::Base:0x23bbabc>You have no route for posts declared. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
How do i set the route? Sorry, i''m new to Rails On Oct 17, 10:36 am, Andrew Porter <a...-OV3k8GMR8cdg9hUCZPvPmw@public.gmane.org> wrote:> Zack K. wrote: > > Well right now i''m currently trying to make a form that posts > > information into my database. I''m using the form_for function, but > > when i run the server and go to the page and get this error: > > > undefined method `posts_path'' for #<ActionView::Base:0x23bbabc> > > You have no route for posts declared.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zack K. wrote:> How do i set the route? > Sorry, i''m new to RailsYou can only use named routes (which form_for uses when you pass it an AR object) if you declare them. This is done with the map.resource and map.resources methods in your config/routes.rb file. Read up on named routes. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well now i have it working so i don''t get an error, but it doesn''t submit the information into the server. On Oct 17, 10:56 am, Andrew Porter <a...-OV3k8GMR8cdg9hUCZPvPmw@public.gmane.org> wrote:> Zack K. wrote: > > How do i set the route? > > Sorry, i''m new to Rails > > You can only use named routes (which form_for uses when you pass it an > AR object) if you declare them. This is done with the map.resource and > map.resources methods in your config/routes.rb file. Read up on named > routes.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What do you have in your posts_controller? On Oct 17, 12:00 pm, "Zack K." <rallokk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well now i have it working so i don''t get an error, but it doesn''t > submit the information into the server. > > On Oct 17, 10:56 am, Andrew Porter <a...-OV3k8GMR8cdg9hUCZPvPmw@public.gmane.org> wrote: > > > Zack K. wrote: > > > How do i set the route? > > > Sorry, i''m new to Rails > > > You can only use named routes (which form_for uses when you pass it an > > AR object) if you declare them. This is done with the map.resource and > > map.resources methods in your config/routes.rb file. Read up on named > > routes.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---