I am running Mac OS X 10.3.8, when I use rails, I cannot seem to access much of the functionality. I always end up with an error like: http://homepage.mac.com/iefan/rails1.html So first I tried out the Todo list tutorial on the Rubys on Rail site. Similar errors. I thought maybe I was having some problems with my install. Removed everything I installed, then clean installed ruby with readline, tcl, and tk. Mysql doesn''t appear to be the problem, since I can access stuff via the console. My RecipeController has only ''scaffold :recipe'' and sometimes ''model :recipe'' (though the model affect it at all, still just dies). Any ideas? It would be greatly helpful... thanks. ~Travis ===================== stuff ==================== $ ruby script/console Loading development environment. irb(main):001:0> r = Recipe.find(1) => #<Recipe:0x257b93c @attributes={"title"=>"", "id"=>"1", "instructions"=>""}> irb(main):002:0> exit $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 21 to server version: 4.1.9-max Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer. mysql> use cookbook; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> SELECT * FROM recipes; +----+-------+--------------+ | id | title | instructions | +----+-------+--------------+ | 2 | | | | 1 | | | +----+-------+--------------+ 2 rows in set (0.08 sec) mysql> $ ruby --version ruby 1.8.2 (2005-02-23) [powerpc-darwin7.8.0] $ gem --version 0.8.4 $ mysql --version mysql Ver 14.7 Distrib 4.1.9, for apple-darwin7.7.0 (powerpc) $ gem list --local | grep "^[^ ]" *** LOCAL GEMS *** actionmailer (0.7.0) actionpack (1.5.0) actionwebservice (0.5.0) activerecord (1.7.0) activesupport (1.0.0) BlueCloth (1.0.0) builder (1.2.3) creditcard (1.0) mysql (2.5.1) needle (1.2.0) net-sftp (0.9.0) net-ssh (1.0.0) payment (0.9) rails (0.10.0) rake (0.4.15) RedCloth (3.0.3) rubypants (0.2.0) rubyzip (0.5.5) sources (0.0.1) syntax (0.5.0) text-highlight (1.0.2) tidy (1.1.0) webgen (0.3.0)
Looks like you''re being sent off to your mac.com homepage, which I suppose would mean your Apache server isn''t running/setup right. For a quick start, or just to confirm that hypothesis, try running the built-in web server in your application. Just : cd ~/yourapp script/server And you should see that WebRick is running. Open your web browser and look at http://localhost:3000 and you should see the "Congratulations, you''re on Rails" page. from there you can open http://localhost:3000/yourapp/recipe/list If that works, go into System Preferences... from the Apple menu. Look at Sharing, you should have Personal Web Sharing turned on if you want to use the Apache server that comes with OS X. You will want to put your application in either ~/Sites, or /Library/WebServer/. You will find the Apache configuration file in /etc/httpd/httpd.conf. If you don''t have nmap, it''s worth getting it. ( port install nmap if you''re using DarwinPorts). Just run it on localhost and let it tell you which ports are open: nmap localhost You will get a list of ports like so: Starting nmap V. 3.00 ( www.insecure.org/nmap/ ) Interesting ports on localhost (127.0.0.1): (The 1584 ports scanned but not shown below are in state: closed) Port State Service ... 80/tcp open http ... 3000/tcp open ppp 3306/tcp open mysql ... (I edited out several and added the ...) 80 is the webserver. 3000 is not ppp in my case, but WebRick. 3306 is the MySQL server. I recently installed DarwinPorts and used it to install Apache 2.x.x. Really easy. You should decide, however, if you want to use fink, DarwinPorts, PkgSrc, etc. and stick to it, otherwise you have duplicate packages all over the place. (Fink likes to put things in /sw, DarwinPorts in /opt, etc.) If, on the other hand, you''re trying to set up your application on your .mac account, I''m afraid to say that won''t work, as you need CGI, Ruby and lots of other things the .mac account does not provide. Regards, JJ On 25-Feb-2005, at 11:48, Travis Smith wrote:> I am running Mac OS X 10.3.8, when I use rails, I cannot seem to > access much of the functionality. I always end up with an error like: > http://homepage.mac.com/iefan/rails1.html > > So first I tried out the Todo list tutorial on the Rubys on Rail site. > Similar errors. I thought maybe I was having some problems with my > install. Removed everything I installed, then clean installed ruby > with readline, tcl, and tk. > > Mysql doesn''t appear to be the problem, since I can access stuff via > the console. My RecipeController has only ''scaffold :recipe'' and > sometimes ''model :recipe'' (though the model affect it at all, still > just dies). > > Any ideas? It would be greatly helpful... thanks. > > ~Travis > > ===================== stuff ====================> > $ ruby script/console > Loading development environment. > irb(main):001:0> r = Recipe.find(1) > => #<Recipe:0x257b93c @attributes={"title"=>"", "id"=>"1", > "instructions"=>""}> > irb(main):002:0> exit > $ mysql -u root > Welcome to the MySQL monitor. Commands end with ; or \g. > Your MySQL connection id is 21 to server version: 4.1.9-max > > Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer. > > mysql> use cookbook; > Reading table information for completion of table and column names > You can turn off this feature to get a quicker startup with -A > > Database changed > mysql> SELECT * FROM recipes; > +----+-------+--------------+ > | id | title | instructions | > +----+-------+--------------+ > | 2 | | | > | 1 | | | > +----+-------+--------------+ > 2 rows in set (0.08 sec) > > mysql> > > $ ruby --version > ruby 1.8.2 (2005-02-23) [powerpc-darwin7.8.0] > $ gem --version > 0.8.4 > $ mysql --version > mysql Ver 14.7 Distrib 4.1.9, for apple-darwin7.7.0 (powerpc) > $ gem list --local | grep "^[^ ]" > *** LOCAL GEMS *** > actionmailer (0.7.0) > actionpack (1.5.0) > actionwebservice (0.5.0) > activerecord (1.7.0) > activesupport (1.0.0) > BlueCloth (1.0.0) > builder (1.2.3) > creditcard (1.0) > mysql (2.5.1) > needle (1.2.0) > net-sftp (0.9.0) > net-ssh (1.0.0) > payment (0.9) > rails (0.10.0) > rake (0.4.15) > RedCloth (3.0.3) > rubypants (0.2.0) > rubyzip (0.5.5) > sources (0.0.1) > syntax (0.5.0) > text-highlight (1.0.2) > tidy (1.1.0) > webgen (0.3.0) > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 25-Feb-2005, at 16:02, John Johnson wrote:> http://localhost:3000/yourapp/recipe/list >Sorry, should be http://localhost:3000/recipe/list
I posted the page on my .Mac account so it easy for people see what errors I was getting when I ran the ruby webserver. (ruby script/server -d) Today I deleted much of what was on my .Mac account''s website as well - luckly I always have backups. Just takes a while for them to load, so if you looked and failed to the find the page it should be back now. I can get the first page fine (http://localhost:3000/) - and if I just add a method such as def index render_text "Hello World!" end to my controller, then the index page (http://localhost:3000/recipe/ or http://localhost:3000/recipe/index) for the cookbook shows up just fine. As soon as I add something that accesses the Recipe object, it gives me that error (unless I do it from the console, which is odd). Thanks JJ, but I think error is elsewhere. ~Travis
Okay, I got it working! Though the problem appears to be odd. If I run the webserver as ''ruby script/server -d'' it fails as described. When I run it interactively as ''ruby script/server'' it runs just fine. This is odd, anyone have any ideas on how to address this? Thanks. On Fri, 25 Feb 2005 16:29:04 -0500, Travis Smith <zultan.durin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I posted the page on my .Mac account so it easy for people see what > errors I was getting when I ran the ruby webserver. (ruby > script/server -d) > > I can get the first page fine (http://localhost:3000/) - and if I > just add a method such as > > def index > render_text "Hello World!" > end > > to my controller, then the index page (http://localhost:3000/recipe/ > or http://localhost:3000/recipe/index) for the cookbook shows up just > fine. As soon as I add something that accesses the Recipe object, it > gives me that error (unless I do it from the console, which is odd). > > Thanks JJ, but I think error is elsewhere. > > ~Travis >
> Okay, I got it working! Though the problem appears to be odd. If I run > the webserver as ''ruby script/server -d'' it fails as described. When I > run it interactively as ''ruby script/server'' it runs just fine. This > is odd, anyone have any ideas on how to address this?The -d bug was fixed in Rails 0.10.0. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://www.loudthinking.com/ -- Broadcasting Brain
Sorry, I thought that was a literal error, and not a meta-error :-) I see you solved your problem though. That''s a good thing. FWIW usually when I have an error ''uninitialized constant Whatever'', it means I have a syntax error in the whatever.rb file. In such case, the log file log/development.log usually has more detail about why it failed. Regards, JJ On 25-Feb-2005, at 16:29, Travis Smith wrote:> I posted the page on my .Mac account so it easy for people see what > errors I was getting when I ran the ruby webserver. (ruby > script/server -d) Today I deleted much of what was on my .Mac > account''s website as well - luckly I always have backups. Just takes a > while for them to load, so if you looked and failed to the find the > page it should be back now. > > I can get the first page fine (http://localhost:3000/) - and if I > just add a method such as > > def index > render_text "Hello World!" > end > > to my controller, then the index page (http://localhost:3000/recipe/ > or http://localhost:3000/recipe/index) for the cookbook shows up just > fine. As soon as I add something that accesses the Recipe object, it > gives me that error (unless I do it from the console, which is odd). > > Thanks JJ, but I think error is elsewhere. > > ~Travis > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I''m definitely getting the same error with code developed in earlier versions of Rails. Looks like the paths aren''t being picked up correctly, or really it seems more inconsistent than that. I''m starting to see a number of examples of this issue out on the ''net. Is there yet a concensus on how to fix this, other than downgrading? Thanks On Feb 25, 2005, at 11:48 AM, Travis Smith wrote:> I am running Mac OS X 10.3.8, when I use rails, I cannot seem to > access much of the functionality. I always end up with an error like: > http://homepage.mac.com/iefan/rails1.html > > So first I tried out the Todo list tutorial on the Rubys on Rail site. > Similar errors. I thought maybe I was having some problems with my > install. Removed everything I installed, then clean installed ruby > with readline, tcl, and tk. > > Mysql doesn''t appear to be the problem, since I can access stuff via > the console. My RecipeController has only ''scaffold :recipe'' and > sometimes ''model :recipe'' (though the model affect it at all, still > just dies). > > Any ideas? It would be greatly helpful... thanks. > > ~Travis > > ===================== stuff ====================> > $ ruby script/console > Loading development environment. > irb(main):001:0> r = Recipe.find(1) > => #<Recipe:0x257b93c @attributes={"title"=>"", "id"=>"1", > "instructions"=>""}> > irb(main):002:0> exit > $ mysql -u root > Welcome to the MySQL monitor. Commands end with ; or \g. > Your MySQL connection id is 21 to server version: 4.1.9-max > > Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer. > > mysql> use cookbook; > Reading table information for completion of table and column names > You can turn off this feature to get a quicker startup with -A > > Database changed > mysql> SELECT * FROM recipes; > +----+-------+--------------+ > | id | title | instructions | > +----+-------+--------------+ > | 2 | | | > | 1 | | | > +----+-------+--------------+ > 2 rows in set (0.08 sec) > > mysql> > > $ ruby --version > ruby 1.8.2 (2005-02-23) [powerpc-darwin7.8.0] > $ gem --version > 0.8.4 > $ mysql --version > mysql Ver 14.7 Distrib 4.1.9, for apple-darwin7.7.0 (powerpc) > $ gem list --local | grep "^[^ ]" > *** LOCAL GEMS *** > actionmailer (0.7.0) > actionpack (1.5.0) > actionwebservice (0.5.0) > activerecord (1.7.0) > activesupport (1.0.0) > BlueCloth (1.0.0) > builder (1.2.3) > creditcard (1.0) > mysql (2.5.1) > needle (1.2.0) > net-sftp (0.9.0) > net-ssh (1.0.0) > payment (0.9) > rails (0.10.0) > rake (0.4.15) > RedCloth (3.0.3) > rubypants (0.2.0) > rubyzip (0.5.5) > sources (0.0.1) > syntax (0.5.0) > text-highlight (1.0.2) > tidy (1.1.0) > webgen (0.3.0) > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >