Hai
Iam newbie.
Iam using ruby on rails, I have some doubts in it.
The steps i followed is Using ruby 1.8.6 rails 2.2.2
http://www.ibm.com/developerworks/linux/library/l-rubyrails/
1) created the rails project name
2)created the table name contacts in the addressbook database name in Mysql.
3) altered in the database.yml
adapter: mysql database: addressbook host: localhost username: root password: root pool: 5 timeout: 5000
4) ruby script/generate model contact
5)ruby script/generate controller contact
6)ruby script/generate scaffold contacts.
7) altered in
class ContactController < ApplicationController model :contact scaffold :contact end
Errors:
model is unknown.
8) class ContactsController < ApplicationController def list @contacts = Contact.find_all end def show @contact = Contact.find(@params['id']) end def create @contact = Contact.new(@params['contact']) if @contact.save flash['notice'] = 'Contact was successfully created.' redirect_to :action => 'list' else render_action 'new' end end 9) list.rhtml
<% for contact in @contacts %> <tr> <% for column in Contact.content_columns %> <td><%=h contact.send(column.name) %></td> <% end %> <td><%= link_to 'Show', :action => 'show', :id => contact.id %></td> <td><%= link_to 'Edit', :action => 'edit', :id => contact.id %></td> <td><%= link_to 'Destroy', :action => 'destroy', :id => contact.id %></td> </tr> <% end %>
Error: end
C:/Ruby/AddressBook/app/controllers/contacts_controller.rb:16: syntax error, unexpected $end, expecting kEND