Ruby on Rails - 2.1 Tutorial

Issues related to building and deploying Ruby on Rails.
no avatar
tutorialspoint
Site Admin
 
Posts: 144
Joined: Fri Apr 27, 2007 6:52 pm

Ruby on Rails - 2.1 Tutorial

by tutorialspoint » Sat Jun 14, 2008 8:27 pm

Dear Friends,

This is just for your information that I have started preparing a tutorial on Ruby on Rails 2.1 and it will be uploaded before end of June 2008.

Hope you will like this tutorial as well.

Thanks
Moderator, TP
Keep visiting and share this site with your friends.

no avatar
richardwo
 
Posts: 1
Joined: Tue Aug 12, 2008 10:12 am

»when to create database tables ?

by richardwo » Tue Aug 12, 2008 10:16 am

Hello,

Have I missed something really obvious here ?
The 'Database Setup' page just creates an empty database - then the tutorial moves on to generating the model, even though the tables don't exist yet ?

Should we create the tables in SQL first - if so, can you provide the SQL so it is just a cut and paste job.

Thanks,
Richard.

no avatar
peekay
 
Posts: 2
Joined: Wed Jun 17, 2009 3:43 am

by peekay » Wed Jun 17, 2009 3:48 am

Hello,
I have been following this tutorial, but ran into a problem. In:
http://www.tutorialspoint.com/ruby-on-r ... -views.htm
I get to the point where I created the new method, but once I navigate to http://localhost:3000/book/new, I end up with this error:

NoMethodError in Book#new
Showing app/views/book/new.html.erb where line #4 raised:
undefined method `title' for #<Book id: nil, created_at: nil, updated_at: nil>

Extracted source (around line #4):
1: <h1>Add new book</h1>
2: <% form_tag :action => 'create' do %>
3: <p><label for="book_title">Title</label>:
4: <%= text_field 'book', 'title' %></p>
5: <p><label for="book_price">Price</label>:
6: <%= text_field 'book', 'price' %></p>
7: <p><label for="book_subject">Subject</label>:

Can someone help me out. This is my first RoR tutorial and I'm already stuck
:roll:

Thanks!

no avatar
tutorialspoint
Site Admin
 
Posts: 144
Joined: Fri Apr 27, 2007 6:52 pm

by tutorialspoint » Wed Jun 17, 2009 6:54 pm

Hi,

I would suggest you to follow my tutorial a to z. I have tested all the examples very well before uploading them on the site.

Thanks
Moderator, TP
Keep visiting and share this site with your friends.

no avatar
peekay
 
Posts: 2
Joined: Wed Jun 17, 2009 3:43 am

by peekay » Wed Jul 22, 2009 11:56 pm

I have been following it A to Z multiple times now. I still get an error associated with the "new" view, specifically the text_field or collection_select methods. I get a "No Method Error" that reads:

Showing app/views/book/new.html.erb where line #4 raised:
undefined method `title' for #<Book id: nil, created_at: nil, updated_at: nil>



I believe that the tutorial works, I'm just looking for help with what might be wrong with my setup if I make it all the way to this point and repeatedly run into this problem. Thanks.

no avatar
uncele
 
Posts: 1
Joined: Wed Oct 07, 2009 10:04 pm

by uncele » Wed Oct 07, 2009 11:06 pm

I have been following it A to Z multiple times now. I still get an error associated with the "new" view, specifically the text_field or collection_select methods. I get a "No Method Error" that reads:

Showing app/views/book/new.html.erb where line #4 raised:
undefined method `title' for #<Book id: nil, created_at: nil, updated_at: nil>


I believe that the tutorial works, I'm just looking for help with what might be wrong with my setup if I make it all the way to this point and repeatedly run into this problem. Thanks.


So, nobody have solution for this problem?
I'm stuck too in this plase.
If somebody know, how fix it, please help.

no avatar
Tantor
 
Posts: 1
Joined: Sun Feb 21, 2010 7:10 pm

by Tantor » Sun Feb 21, 2010 7:13 pm

Hi, I have the same problem:

NoMethodError in Book#new

Showing app/views/book/new.rhtml where line #4 raised:

undefined method `title' for #<Book id: nil, created_at: nil, updated_at: nil>
Extracted source (around line #4):

1: <h1>Add new book</h1>
2: <%= form_tag :action => 'create' %>
3: <p><label for="book_title">Title</label>:
4: <%= text_field 'book', 'title' %></p>
5: <p><label for="book_price">Price</label>:
6: <%= text_field 'book', 'price' %></p>
7: <p><label for="book_subject">Subject</label>:

annoying isn't it?! MIGHT IT BE A VERSION PROBLEM???

no avatar
Matt John
 
Posts: 2
Joined: Mon Sep 28, 2009 11:29 am

by Matt John » Fri May 21, 2010 6:00 am

I am glad that I was of help. I had been occupied by some extra stuff for last 2 weeks and hence I was not able to post part 2. But I will do it soon, so stay tuned.
I have actually been trying to learn rails 1.x with my “newâ€

no avatar
TimSC
 
Posts: 1
Joined: Thu Jul 22, 2010 2:40 pm

»

by TimSC » Thu Jul 22, 2010 2:52 pm

I had this problem but then I found I needed to modify the migrations files in the db/migrate folder as it discusses on this page: http://www.tutorialspoint.com/ruby-on-r ... ations.htm

TimSC

no avatar
epuj
 
Posts: 1
Joined: Wed Sep 15, 2010 12:02 pm

Send Email using Rails 2.1

by epuj » Wed Sep 15, 2010 12:04 pm

mistake in example http://www.tutorialspoint.com/ruby-on-r ... emails.htm
def index
render :file => 'app\views\emailer\index.htm.erb'
end

should be

def index
render :file => 'app\views\emailer\index.html.erb'
end

no avatar
dill100
 
Posts: 1
Joined: Tue Sep 21, 2010 8:28 am

GREAT SITE

by dill100 » Tue Sep 21, 2010 8:30 am

Please use blackslash before opening square bracket becuase this is reserved to specifiy multiple search options....

So try the following and it won't give warning..

Return to Ruby on Rails

cron