undefined method `lessons_path'

26 views
Skip to first unread message

Turcu Marius

unread,
Aug 6, 2014, 2:40:08 AM8/6/14
to rubyonra...@googlegroups.com
Hi all! I'm new to Rails and i have some problems with this code.

I have this form in a view of page controller
<%= form_for Lesson.new do %>
<%= label_tag(:number, "Enter the number") %>
<%= text_field_tag :number %>
<%= label_tag(:root, "root") %>
<%= text_field_tag :root %>
<%= submit_tag("Submit") %>
<% end %>

In Lesson controller i've methods new create and soo on.
I'm not sure how to use this form in another view.
I have this error undefined method `lessons_path'
I repeat i'm new to rails, have 2 days:))

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Aug 6, 2014, 3:06:00 AM8/6/14
to rubyonra...@googlegroups.com
Perhaps you have not put an entry for lessons in routes.rb.

However I suggest that you work right through a good tutorial such as
railstutorial.org, (which is free to use online). That will show you
the basics of Rails with much less pain than jumping in at the deep
end by yourself.

Colin

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e3bc0a4a7d1e9eaa787ed9d63ef604aa%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Turcu Marius

unread,
Aug 6, 2014, 3:17:30 AM8/6/14
to rubyonra...@googlegroups.com
Thanks, Colin.Yes, i know, i jumped in front of a train with this but
must do this aplication...what must have in routes? now i have get
'lessons/add_lesson'....And another question if i what to use this form
in a view created by another controller how i make the connection?
Thanks for your quick answer.

Colin Law

unread,
Aug 6, 2014, 4:36:32 AM8/6/14
to rubyonra...@googlegroups.com
On 6 August 2014 08:17, Turcu Marius <li...@ruby-forum.com> wrote:
> Thanks, Colin.Yes, i know, i jumped in front of a train with this but
> must do this aplication...what must have in routes? now i have get
> 'lessons/add_lesson'....And another question if i what to use this form
> in a view created by another controller how i make the connection?

In the long run you will get it done quicker if you take two days out
to go through the tutorial. You cannot expect people here to lead you
through every trivial aspect of building an app. For routes see the
Rails Guide on Routing. To use a form in multiple views then use a
partial. Again this is all covered in the tutorial.

Colin
Reply all
Reply to author
Forward
0 new messages