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
--
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 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
-~----------~----~----~----~------~----~------~--~---
On Dec 15, 7:18 am, Angappan Ayyavoo <rails-mailing-l...@andreas- s.net> wrote:> 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/ >Your tutorial is 3 and a half years old. Rails has changed tremendously since then. A lot of that information in that tutorial doesn''t cover how newer versions of rails do it or just won''t work anymore.> 7) altered in > > class ContactController < ApplicationController > model :contact > scaffold :contact > end > > Errors: > > model is unknown.Both the model and scaffold methods were removed> > 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 > > Error: end > > C:/Ruby/AddressBook/app/controllers/contacts_controller.rb:16: syntax > error, unexpected $end, expecting kENDIf you indent that file properly it should be clear that you are indeed missing an ''end'' Fred> -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi
Do like this
rails project_name
./script/generate scaffold contact
rake db:migrate
Now run the application ./script/server
--
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 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
-~----------~----~----~----~------~----~------~--~---
Thanks. For ur kind reply. May I know which version of ruby and rails is stable. Give me some better links to learn and work in ruby on rails. -- 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 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 -~----------~----~----~----~------~----~------~--~---
Angappan Ayyavoo wrote:> Thanks. > For ur kind reply. > > May I know which version of ruby and rails is stable. > Give me some better links to learn and work in ruby on rails.Ruby on Rails 2.2.2 is the current stable release of Rails. http://rubyonrails.org/screencasts http://guides.rubyonrails.org/ http://railscasts.com/ http://www.therailsway.com/ http://peepcode.com/ http://www.railsenvy.com/ http://api.rubyonrails.org/ Books: http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-Ruby/dp/0321445619 That should get you started. Also from those links, look for other related links and get to know the community of Rails developers. Find and read their blogs. There is a ton of really good information out there, once you know where to start looking. -- 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 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 -~----------~----~----~----~------~----~------~--~---