Hello, I am referrign to the cookbook example. 1. How does rails know when I generate the controller and model for Recipe that it needs to read the recipes table? 2. I am using instantRails, how can I change the default MySql localhost to use another MySql on another server 10.10.5.x? 3. Can rails do the things I do currently in PHP and JSP? Like login and exporting to pdf/world 4. How do I validate a field to say it is required? Thanks for the help. Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org
1. the table is based on pluralizing your model. Recipe = recipes table. This can all be configured through Active Record. As a beginner, I wouldn''t worry about it yet. 2. InstantRails has a config file that can be modified. However, one thing at a time... Get comfortable writing rails apps using the built in server. Then go learn InstantRails... It''s not necessary to learn the language. Your rails application is going to determine the database you use, not InstantRails. 3.Yup. You should buy the "Agile Web Development with Rails" book. It covers login very well and really answers a lot of beginner (and advanced) questions. Plus you''re supporting the development of Rails (in a way). As for PDF, though I''ve not done it, I know it''s possible and there are those on the list who have had much success with it/ 4. Validation is easy in Rails. In your Recipe model (recipe.rb) add this line after the class declaration: (between ''class Recipe'' and ''end'' validates_presence_of :title To validate the title field. There''s many other validators like "validates_numericality_of" and others. Since you''re doing JSP, you should be pretty comfortable with an API and Rails has a great one at http://api.rubyonrails.com/ I hope this helps answer your questions. If you can remember that Rails is much more than scaffolding and ''magic'', you''ll start to love it and you''ll be amazed every single day at what it can help you create. Good luck! -Brian Hogan -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco Sent: Thursday, December 01, 2005 10:14 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] newbie - a few questions Hello, I am referrign to the cookbook example. 1. How does rails know when I generate the controller and model for Recipe that it needs to read the recipes table? 2. I am using instantRails, how can I change the default MySql localhost to use another MySql on another server 10.10.5.x? 3. Can rails do the things I do currently in PHP and JSP? Like login and exporting to pdf/world 4. How do I validate a field to say it is required? Thanks for the help. Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks, for explaining, it sure helps. I did order the book yesterday.>1. the table is based on pluralizing your model. Recipe = recipes table.This seems it might cause me problems as some of my tables are named software, locations, employees.>2. InstantRails has a config file that can be modified. However, oneI already have Instant Rails installed at work, but use a Mac at Home. Are you saying I should not use this now? Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >Subject: RE: [Rails] newbie - a few questions >Date: Thu, 1 Dec 2005 10:29:27 -0600 > >1. the table is based on pluralizing your model. Recipe = recipes table. >This can all be configured through Active Record. As a beginner, I >wouldn''t worry about it yet. > >2. InstantRails has a config file that can be modified. However, one >thing at a time... Get comfortable writing rails apps using the built in >server. Then go learn InstantRails... It''s not necessary to learn the >language. Your rails application is going to determine the database you >use, not InstantRails. > >3.Yup. You should buy the "Agile Web Development with Rails" book. It >covers login very well and really answers a lot of beginner (and >advanced) questions. Plus you''re supporting the development of Rails (in >a way). > >As for PDF, though I''ve not done it, I know it''s possible and there are >those on the list who have had much success with it/ > >4. Validation is easy in Rails. > >In your Recipe model (recipe.rb) add this line after the class >declaration: (between ''class Recipe'' and ''end'' > > validates_presence_of :title > >To validate the title field. There''s many other validators like >"validates_numericality_of" and others. > >Since you''re doing JSP, you should be pretty comfortable with an API and >Rails has a great one at http://api.rubyonrails.com/ > >I hope this helps answer your questions. If you can remember that Rails >is much more than scaffolding and ''magic'', you''ll start to love it and >you''ll be amazed every single day at what it can help you create. > >Good luck! > >-Brian Hogan > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >Sent: Thursday, December 01, 2005 10:14 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: [Rails] newbie - a few questions > > >Hello, > >I am referrign to the cookbook example. > >1. How does rails know when I generate the controller and model for >Recipe >that it needs to read the recipes table? > >2. I am using instantRails, how can I change the default MySql localhost >to >use another MySql on another server 10.10.5.x? > >3. Can rails do the things I do currently in PHP and JSP? Like login and > >exporting to pdf/world > >4. How do I validate a field to say it is required? > >Thanks for the help. > > >Regards, > >Frank Rocco >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, Frank, than set_table_name "[your table name]" will be your friend. Have a look at: http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas regards Jan Frank Rocco wrote:> Thanks, for explaining, it sure helps. > > I did order the book yesterday. > >> 1. the table is based on pluralizing your model. Recipe = recipes table. > > This seems it might cause me problems as some of my tables are named > software, locations, employees. > >> 2. InstantRails has a config file that can be modified. However, one > > I already have Instant Rails installed at work, but use a Mac at Home. > Are you saying I should not use this now? > > > > Regards, > > Frank Rocco > farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > >> From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >> Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >> Subject: RE: [Rails] newbie - a few questions >> Date: Thu, 1 Dec 2005 10:29:27 -0600 >> >> 1. the table is based on pluralizing your model. Recipe = recipes table. >> This can all be configured through Active Record. As a beginner, I >> wouldn''t worry about it yet. >> >> 2. InstantRails has a config file that can be modified. However, one >> thing at a time... Get comfortable writing rails apps using the built in >> server. Then go learn InstantRails... It''s not necessary to learn the >> language. Your rails application is going to determine the database you >> use, not InstantRails. >> >> 3.Yup. You should buy the "Agile Web Development with Rails" book. It >> covers login very well and really answers a lot of beginner (and >> advanced) questions. Plus you''re supporting the development of Rails (in >> a way). >> >> As for PDF, though I''ve not done it, I know it''s possible and there are >> those on the list who have had much success with it/ >> >> 4. Validation is easy in Rails. >> >> In your Recipe model (recipe.rb) add this line after the class >> declaration: (between ''class Recipe'' and ''end'' >> >> validates_presence_of :title >> >> To validate the title field. There''s many other validators like >> "validates_numericality_of" and others. >> >> Since you''re doing JSP, you should be pretty comfortable with an API and >> Rails has a great one at http://api.rubyonrails.com/ >> >> I hope this helps answer your questions. If you can remember that Rails >> is much more than scaffolding and ''magic'', you''ll start to love it and >> you''ll be amazed every single day at what it can help you create. >> >> Good luck! >> >> -Brian Hogan >> >> -----Original Message----- >> From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >> Sent: Thursday, December 01, 2005 10:14 AM >> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: [Rails] newbie - a few questions >> >> >> Hello, >> >> I am referrign to the cookbook example. >> >> 1. How does rails know when I generate the controller and model for >> Recipe >> that it needs to read the recipes table? >> >> 2. I am using instantRails, how can I change the default MySql localhost >> to >> use another MySql on another server 10.10.5.x? >> >> 3. Can rails do the things I do currently in PHP and JSP? Like login and >> >> exporting to pdf/world >> >> 4. How do I validate a field to say it is required? >> >> Thanks for the help. >> >> >> Regards, >> >> Frank Rocco >> farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
1. Well, look at the api... It''s a single line of code to associate a Software model with the "software" table instead of the "softwares" table. Remember.... It ASSUMES the plurality for you so you can speed up development, but you can ALWAYS explicitly tell it what to do. You''ll find that Rails makes a lot of assumptions, and they''re actually really *good* assumptions if you''re developing a new app. class software < ActiveRecord::Base set_table_name "software" set_primary_key "software_id" set_sequence_name "softwareseq " # default would have been "project_seq" end 2. WEBrick, the built-in server that runs on port 3000 is great for development because it''s self-contained. InstantRails (at least in my humble opinion) is more for staging your applications to see how they run on Apache, and maybe even for production. I would use WEBrick for development, especially if you plan to move your code from a PC to a Mac and then back again.... There''s no configuration! Just run script/server (or on windows, ruby scrip/server) from the root of your rails project. That said, InstantRails *is* pretty handy if you don''t have Ruby, Rails, and mySQL already installed on a machine. But I would definitely still use WEBrick when you''re developing and then mess with configuring your apps on Apache or Lighttpd at a later time. It tends to distract you... Instead of coding rails, you become frustrated with trying to learn Rails and configure Apache + SCGI + Rails and you cast Rails off as ''too hard'' (It''s happened to some people I know...) Good luck! -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco Sent: Thursday, December 01, 2005 10:45 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails] newbie - a few questions Thanks, for explaining, it sure helps. I did order the book yesterday.>1. the table is based on pluralizing your model. Recipe = recipes >table.This seems it might cause me problems as some of my tables are named software, locations, employees.>2. InstantRails has a config file that can be modified. However, oneI already have Instant Rails installed at work, but use a Mac at Home. Are you saying I should not use this now? Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >Subject: RE: [Rails] newbie - a few questions >Date: Thu, 1 Dec 2005 10:29:27 -0600 > >1. the table is based on pluralizing your model. Recipe = recipes >table. This can all be configured through Active Record. As a beginner,>I wouldn''t worry about it yet. > >2. InstantRails has a config file that can be modified. However, one >thing at a time... Get comfortable writing rails apps using the built >in server. Then go learn InstantRails... It''s not necessary to learn >the language. Your rails application is going to determine the >database you use, not InstantRails. > >3.Yup. You should buy the "Agile Web Development with Rails" book. It >covers login very well and really answers a lot of beginner (and >advanced) questions. Plus you''re supporting the development of Rails >(in a way). > >As for PDF, though I''ve not done it, I know it''s possible and there are>those on the list who have had much success with it/ > >4. Validation is easy in Rails. > >In your Recipe model (recipe.rb) add this line after the class >declaration: (between ''class Recipe'' and ''end'' > > validates_presence_of :title > >To validate the title field. There''s many other validators like >"validates_numericality_of" and others. > >Since you''re doing JSP, you should be pretty comfortable with an API >and Rails has a great one at http://api.rubyonrails.com/ > >I hope this helps answer your questions. If you can remember that >Rails is much more than scaffolding and ''magic'', you''ll start to love >it and you''ll be amazed every single day at what it can help you >create. > >Good luck! > >-Brian Hogan > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >Sent: Thursday, December 01, 2005 10:14 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: [Rails] newbie - a few questions > > >Hello, > >I am referrign to the cookbook example. > >1. How does rails know when I generate the controller and model for >Recipe that it needs to read the recipes table? > >2. I am using instantRails, how can I change the default MySql >localhost to use another MySql on another server 10.10.5.x? > >3. Can rails do the things I do currently in PHP and JSP? Like login >and > >exporting to pdf/world > >4. How do I validate a field to say it is required? > >Thanks for the help. > > >Regards, > >Frank Rocco >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Again, thanks for your help. I really am starting to like Rails. I''m diving right in. Are there more advanced web tutorials? I already did the cookbook. What do you recommend for a editor in Windows and Mac? Is Komodo a good choice? Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >Subject: RE: [Rails] newbie - a few questions >Date: Thu, 1 Dec 2005 11:47:06 -0600 > >1. Well, look at the api... It''s a single line of code to associate a >Software model with the "software" table instead of the "softwares" >table. Remember.... It ASSUMES the plurality for you so you can speed >up development, but you can ALWAYS explicitly tell it what to do. >You''ll find that Rails makes a lot of assumptions, and they''re actually >really *good* assumptions if you''re developing a new app. > > class software < ActiveRecord::Base > set_table_name "software" > set_primary_key "software_id" > set_sequence_name "softwareseq " # default would have been >"project_seq" > end > > >2. WEBrick, the built-in server that runs on port 3000 is great for >development because it''s self-contained. InstantRails (at least in my >humble opinion) is more for staging your applications to see how they >run on Apache, and maybe even for production. I would use WEBrick for >development, especially if you plan to move your code from a PC to a Mac >and then back again.... There''s no configuration! Just run script/server >(or on windows, ruby scrip/server) from the root of your rails project. > >That said, InstantRails *is* pretty handy if you don''t have Ruby, Rails, >and mySQL already installed on a machine. But I would definitely still >use WEBrick when you''re developing and then mess with configuring your >apps on Apache or Lighttpd at a later time. It tends to distract you... >Instead of coding rails, you become frustrated with trying to learn >Rails and configure Apache + SCGI + Rails and you cast Rails off as ''too >hard'' (It''s happened to some people I know...) > >Good luck! > > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >Sent: Thursday, December 01, 2005 10:45 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: RE: [Rails] newbie - a few questions > > >Thanks, for explaining, it sure helps. > >I did order the book yesterday. > > >1. the table is based on pluralizing your model. Recipe = recipes > >table. >This seems it might cause me problems as some of my tables are named >software, locations, employees. > > >2. InstantRails has a config file that can be modified. However, one >I already have Instant Rails installed at work, but use a Mac at Home. >Are you saying I should not use this now? > > > >Regards, > >Frank Rocco >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > > >From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> > >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > >Subject: RE: [Rails] newbie - a few questions > >Date: Thu, 1 Dec 2005 10:29:27 -0600 > > > >1. the table is based on pluralizing your model. Recipe = recipes > >table. This can all be configured through Active Record. As a beginner, > > >I wouldn''t worry about it yet. > > > >2. InstantRails has a config file that can be modified. However, one > >thing at a time... Get comfortable writing rails apps using the built > >in server. Then go learn InstantRails... It''s not necessary to learn > >the language. Your rails application is going to determine the > >database you use, not InstantRails. > > > >3.Yup. You should buy the "Agile Web Development with Rails" book. It > >covers login very well and really answers a lot of beginner (and > >advanced) questions. Plus you''re supporting the development of Rails > >(in a way). > > > >As for PDF, though I''ve not done it, I know it''s possible and there are > > >those on the list who have had much success with it/ > > > >4. Validation is easy in Rails. > > > >In your Recipe model (recipe.rb) add this line after the class > >declaration: (between ''class Recipe'' and ''end'' > > > > validates_presence_of :title > > > >To validate the title field. There''s many other validators like > >"validates_numericality_of" and others. > > > >Since you''re doing JSP, you should be pretty comfortable with an API > >and Rails has a great one at http://api.rubyonrails.com/ > > > >I hope this helps answer your questions. If you can remember that > >Rails is much more than scaffolding and ''magic'', you''ll start to love > >it and you''ll be amazed every single day at what it can help you > >create. > > > >Good luck! > > > >-Brian Hogan > > > >-----Original Message----- > >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco > >Sent: Thursday, December 01, 2005 10:14 AM > >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >Subject: [Rails] newbie - a few questions > > > > > >Hello, > > > >I am referrign to the cookbook example. > > > >1. How does rails know when I generate the controller and model for > >Recipe that it needs to read the recipes table? > > > >2. I am using instantRails, how can I change the default MySql > >localhost to use another MySql on another server 10.10.5.x? > > > >3. Can rails do the things I do currently in PHP and JSP? Like login > >and > > > >exporting to pdf/world > > > >4. How do I validate a field to say it is required? > > > >Thanks for the help. > > > > > >Regards, > > > >Frank Rocco > >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails
Frank: I made my own with Eclipse for Windows: http://www.napcs.com/howto/railsonwindows.html Or if you don''t want to build your own, you can use the up-and-coming radrails at www.radrails.org And I hear that TextMate is awesome for the Mac As for tutorials, after you do cookbook, try the ''four days on rails'' or just start buiding your own app. The agile book will cover a much larger app (an online store). -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco Sent: Thursday, December 01, 2005 12:04 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails] newbie - a few questions Again, thanks for your help. I really am starting to like Rails. I''m diving right in. Are there more advanced web tutorials? I already did the cookbook. What do you recommend for a editor in Windows and Mac? Is Komodo a good choice? Regards, Frank Rocco farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >Subject: RE: [Rails] newbie - a few questions >Date: Thu, 1 Dec 2005 11:47:06 -0600 > >1. Well, look at the api... It''s a single line of code to associate a >Software model with the "software" table instead of the "softwares" >table. Remember.... It ASSUMES the plurality for you so you can speed >up development, but you can ALWAYS explicitly tell it what to do. >You''ll find that Rails makes a lot of assumptions, and they''re actually>really *good* assumptions if you''re developing a new app. > > class software < ActiveRecord::Base > set_table_name "software" > set_primary_key "software_id" > set_sequence_name "softwareseq " # default would have been >"project_seq" > end > > >2. WEBrick, the built-in server that runs on port 3000 is great for >development because it''s self-contained. InstantRails (at least in my >humble opinion) is more for staging your applications to see how they >run on Apache, and maybe even for production. I would use WEBrick for >development, especially if you plan to move your code from a PC to a >Mac and then back again.... There''s no configuration! Just run >script/server (or on windows, ruby scrip/server) from the root of your >rails project. > >That said, InstantRails *is* pretty handy if you don''t have Ruby, >Rails, and mySQL already installed on a machine. But I would >definitely still use WEBrick when you''re developing and then mess with >configuring your apps on Apache or Lighttpd at a later time. It tends >to distract you... Instead of coding rails, you become frustrated with >trying to learn Rails and configure Apache + SCGI + Rails and you cast >Rails off as ''too hard'' (It''s happened to some people I know...) > >Good luck! > > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >Sent: Thursday, December 01, 2005 10:45 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: RE: [Rails] newbie - a few questions > > >Thanks, for explaining, it sure helps. > >I did order the book yesterday. > > >1. the table is based on pluralizing your model. Recipe = recipes > >table. >This seems it might cause me problems as some of my tables are named >software, locations, employees. > > >2. InstantRails has a config file that can be modified. However, one >I already have Instant Rails installed at work, but use a Mac at Home. >Are you saying I should not use this now? > > > >Regards, > >Frank Rocco >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > > >From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> > >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > >Subject: RE: [Rails] newbie - a few questions > >Date: Thu, 1 Dec 2005 10:29:27 -0600 > > > >1. the table is based on pluralizing your model. Recipe = recipes > >table. This can all be configured through Active Record. As a > >beginner, > > >I wouldn''t worry about it yet. > > > >2. InstantRails has a config file that can be modified. However, one > >thing at a time... Get comfortable writing rails apps using the built> >in server. Then go learn InstantRails... It''s not necessary to learn > >the language. Your rails application is going to determine the > >database you use, not InstantRails. > > > >3.Yup. You should buy the "Agile Web Development with Rails" book. It> >covers login very well and really answers a lot of beginner (and > >advanced) questions. Plus you''re supporting the development of Rails > >(in a way). > > > >As for PDF, though I''ve not done it, I know it''s possible and there > >are > > >those on the list who have had much success with it/ > > > >4. Validation is easy in Rails. > > > >In your Recipe model (recipe.rb) add this line after the class > >declaration: (between ''class Recipe'' and ''end'' > > > > validates_presence_of :title > > > >To validate the title field. There''s many other validators like > >"validates_numericality_of" and others. > > > >Since you''re doing JSP, you should be pretty comfortable with an API > >and Rails has a great one at http://api.rubyonrails.com/ > > > >I hope this helps answer your questions. If you can remember that > >Rails is much more than scaffolding and ''magic'', you''ll start to love> >it and you''ll be amazed every single day at what it can help you > >create. > > > >Good luck! > > > >-Brian Hogan > > > >-----Original Message----- > >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco > >Sent: Thursday, December 01, 2005 10:14 AM > >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >Subject: [Rails] newbie - a few questions > > > > > >Hello, > > > >I am referrign to the cookbook example. > > > >1. How does rails know when I generate the controller and model for > >Recipe that it needs to read the recipes table? > > > >2. I am using instantRails, how can I change the default MySql > >localhost to use another MySql on another server 10.10.5.x? > > > >3. Can rails do the things I do currently in PHP and JSP? Like login > >and > > > >exporting to pdf/world > > > >4. How do I validate a field to say it is required? > > > >Thanks for the help. > > > > > >Regards, > > > >Frank Rocco > >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I have not seen komodo. I use both subethaedit and textmate. Both very good. bruce On 1-Dec-05, at 11:04 AM, Frank Rocco wrote:> Again, thanks for your help. > > I really am starting to like Rails. > I''m diving right in. > > Are there more advanced web tutorials? > I already did the cookbook. > > What do you recommend for a editor in Windows and Mac? > Is Komodo a good choice? > > Regards, > > Frank Rocco > farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > > > > >> From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >> Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >> Subject: RE: [Rails] newbie - a few questions >> Date: Thu, 1 Dec 2005 11:47:06 -0600 >> >> 1. Well, look at the api... It''s a single line of code to associate a >> Software model with the "software" table instead of the "softwares" >> table. Remember.... It ASSUMES the plurality for you so you can >> speed >> up development, but you can ALWAYS explicitly tell it what to do. >> You''ll find that Rails makes a lot of assumptions, and they''re >> actually >> really *good* assumptions if you''re developing a new app. >> >> class software < ActiveRecord::Base >> set_table_name "software" >> set_primary_key "software_id" >> set_sequence_name "softwareseq " # default would have been >> "project_seq" >> end >> >> >> 2. WEBrick, the built-in server that runs on port 3000 is great for >> development because it''s self-contained. InstantRails (at least in my >> humble opinion) is more for staging your applications to see how they >> run on Apache, and maybe even for production. I would use WEBrick >> for >> development, especially if you plan to move your code from a PC to >> a Mac >> and then back again.... There''s no configuration! Just run script/ >> server >> (or on windows, ruby scrip/server) from the root of your rails >> project. >> >> That said, InstantRails *is* pretty handy if you don''t have Ruby, >> Rails, >> and mySQL already installed on a machine. But I would definitely >> still >> use WEBrick when you''re developing and then mess with configuring >> your >> apps on Apache or Lighttpd at a later time. It tends to distract >> you... >> Instead of coding rails, you become frustrated with trying to learn >> Rails and configure Apache + SCGI + Rails and you cast Rails off >> as ''too >> hard'' (It''s happened to some people I know...) >> >> Good luck! >> >> >> -----Original Message----- >> From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank Rocco >> Sent: Thursday, December 01, 2005 10:45 AM >> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: RE: [Rails] newbie - a few questions >> >> >> Thanks, for explaining, it sure helps. >> >> I did order the book yesterday. >> >> >1. the table is based on pluralizing your model. Recipe = recipes >> >table. >> This seems it might cause me problems as some of my tables are named >> software, locations, employees. >> >> >2. InstantRails has a config file that can be modified. However, one >> I already have Instant Rails installed at work, but use a Mac at >> Home. >> Are you saying I should not use this now? >> >> >> >> Regards, >> >> Frank Rocco >> farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >> >> >> >> >> >> >From: "Hogan, Brian P." <HOGANBP-VnAisaAFmHY@public.gmane.org> >> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >> >Subject: RE: [Rails] newbie - a few questions >> >Date: Thu, 1 Dec 2005 10:29:27 -0600 >> > >> >1. the table is based on pluralizing your model. Recipe = recipes >> >table. This can all be configured through Active Record. As a >> beginner, >> >> >I wouldn''t worry about it yet. >> > >> >2. InstantRails has a config file that can be modified. However, one >> >thing at a time... Get comfortable writing rails apps using the >> built >> >in server. Then go learn InstantRails... It''s not necessary to learn >> >the language. Your rails application is going to determine the >> >database you use, not InstantRails. >> > >> >3.Yup. You should buy the "Agile Web Development with Rails" >> book. It >> >covers login very well and really answers a lot of beginner (and >> >advanced) questions. Plus you''re supporting the development of Rails >> >(in a way). >> > >> >As for PDF, though I''ve not done it, I know it''s possible and >> there are >> >> >those on the list who have had much success with it/ >> > >> >4. Validation is easy in Rails. >> > >> >In your Recipe model (recipe.rb) add this line after the class >> >declaration: (between ''class Recipe'' and ''end'' >> > >> > validates_presence_of :title >> > >> >To validate the title field. There''s many other validators like >> >"validates_numericality_of" and others. >> > >> >Since you''re doing JSP, you should be pretty comfortable with an API >> >and Rails has a great one at http://api.rubyonrails.com/ >> > >> >I hope this helps answer your questions. If you can remember that >> >Rails is much more than scaffolding and ''magic'', you''ll start to >> love >> >it and you''ll be amazed every single day at what it can help you >> >create. >> > >> >Good luck! >> > >> >-Brian Hogan >> > >> >-----Original Message----- >> >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Frank >> Rocco >> >Sent: Thursday, December 01, 2005 10:14 AM >> >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >Subject: [Rails] newbie - a few questions >> > >> > >> >Hello, >> > >> >I am referrign to the cookbook example. >> > >> >1. How does rails know when I generate the controller and model for >> >Recipe that it needs to read the recipes table? >> > >> >2. I am using instantRails, how can I change the default MySql >> >localhost to use another MySql on another server 10.10.5.x? >> > >> >3. Can rails do the things I do currently in PHP and JSP? Like login >> >and >> > >> >exporting to pdf/world >> > >> >4. How do I validate a field to say it is required? >> > >> >Thanks for the help. >> > >> > >> >Regards, >> > >> >Frank Rocco >> >farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >> > >> > >> >_______________________________________________ >> >Rails mailing list >> >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >http://lists.rubyonrails.org/mailman/listinfo/rails >> >_______________________________________________ >> >Rails mailing list >> >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Frank Rocco wrote:> I already have Instant Rails installed at work, but use a Mac at Home. > Are you saying I should not use this now?For your Mac, use Locomotive [1] (free) and TextMate [2] (very affordable - 39 euros). See the movie [3] of the combination in action. (The movie shows an older version of Locomotive, but should be convincing.) regards Justin [1] http://locomotive.sourceforge.net/ [2] http://www.macromates.com/ [3] http://locomotive.sourceforge.net/images/locomotive_intro.mov
frocco wrote:> Hello, > > I am referrign to the cookbook example. > > 1. How does rails know when I generate the controller and model for > Recipe > that it needs to read the recipes table?It pluralizes the model name.> 2. I am using instantRails, how can I change the default MySql localhost > to > use another MySql on another server 10.10.5.x?Look in the config/database.yml file for the application. You specify the host there (and the database, username, pw).> 3. Can rails do the things I do currently in PHP and JSP? Like login and > exporting to pdf/worldYes.> 4. How do I validate a field to say it is required?In the model class. For example to require field "abc" do this: validate_presence_of :abc> Thanks for the help. > > > Regards, > > Frank Rocco > farocco-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.orgHere is the Rails API docs: http://rails.outertrack.com/ -- Posted via http://www.ruby-forum.com/.
I have got instantrails "working". I am not sure if this is the write forum to ask this, so excuse me if it isn''t. Once I have imported the cookbook example into RadRails, I start the server, and it stays on ''Starting'' state. Although the apache piece is working fine, I can''t seem to figure how to put break points or get it show anything on the server console. Any ideas or tutorials ? Thanks HOGANBP wrote:> Frank: > I made my own with Eclipse for Windows: > > http://www.napcs.com/howto/railsonwindows.html > > Or if you don''t want to build your own, you can use the up-and-coming > radrails at www.radrails.org > > And I hear that TextMate is awesome for the Mac > > As for tutorials, after you do cookbook, try the ''four days on rails'' or > just start buiding your own app. The agile book will cover a much larger > app (an online store).-- Posted via http://www.ruby-forum.com/.