I have a simple controller (browse) that uses a "books" action to display a list of books (stored in a mysql db) and a "book_details" action to display the details of a particular book (according to the book''s mysql id). The book_details action is accessed via a link from the books action via the following snippet: <a href=<%= "/browse/book_details/#{_bookID}" %> class="text11" style="text-decoration:none"> <%= _title %> </a> where _title is properly set to the book''s title and _bookID is the mysql id of the book. I''ve verified that _title and _bookID are set properly. Equivalently, I''ve also used the following snippet instead of the above: <%= link_to(_title, { :controller => "browse", :action => "book_details", :id => _bookID }) %> In both of the above cases, I''m using the default route: map.connect '':controller/:action/:id'' In my test environment (Windows XP, Instant Rails, Aptana IDE) everything works just fine. When I try to run this in production mode on the ISP''s site (asmallorange.com - CentOS) the books action works just fine but the book_details action results in the extremely descriptive :-| error message displayed as a webpage: Application error Rails application failed to start properly For the life of me, I don''t see what I''m doing wrong. On the ISP site, I set the log level to debug and compared the log files from both the test (Windows XP) and production (CentOS) environments. The only difference I could find is that in the CentOS production log, I see a SQL_AUTO_IS_NULL message in the log file. I can''t figure out what this means and am not sure how relevant it is. Any suggestions are appreciated. Should I do something special with the routes? Below are the two log files. ===================test environment log file that works (Windows XP) ===================Processing BrowseController#book_details (for 127.0.0.1 at 2008-01-21 14:20:22) [GET] Session ID: e49a3adf336e845be40dc8573f2b32c9 Parameters: {"action"=>"book_details", "id"=>"1", "controller"=>"browse"} ←[4;35;1mBook Columns (0.000000)←[0m ←[0mSHOW FIELDS FROM books←[0m ←[4;36;1mBook Load (0.000000)←[0m ←[0;1mSELECT * FROM books WHERE (books.`id ` = 1) ←[0m Rendering within layouts/browse Rendering browse/book_details Completed in 0.01600 (62 reqs/sec) | Rendering: 0.00000 (0%) | DB: 0.00000 (0%) | 200 OK [http://localhost/browse/book_details/1] ===================production environment log file that doesn''t work (CentOS) ===================# Logfile created on Mon Jan 21 14:29:06 -0500 2008 by / Processing BrowseController#book_details (for 69.143.120.176 at 2008-01-21 14:29 :06) [GET] Session ID: ded95bf9e5a23822f854e9ba58d69d6e Parameters: {"action"=>"book_details", "id"=>"1", "controller"=>"browse"} ^[[4;36;1mSQL (0.000086)^[[0m ^[[0;1mSET SQL_AUTO_IS_NULL=0^[[0m ^[[4;35;1mBook Columns (0.001176)^[[0m ^[[0mSHOW FIELDS FROM books^[[0m ^[[4;36;1mBook Load (0.000065)^[[0m ^[[0;1mSELECT * FROM books WHERE (books. `id` = 1) ^[[0m Rendering within layouts/browse Rendering browse/book_details Completed in 0.06461 (15 reqs/sec) | Rendering: 0.01440 (22%) | DB: 0.00133 (2%) | 200 OK [http://www.epps-alford.com/browse/book_details/1] --~--~---------~--~----~------------~-------~--~----~ 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 1/21/08, sd.codewarrior <sd.codewarrior-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have a simple controller (browse) that uses a "books" action to > display a list of books (stored in a mysql db) and a "book_details"Do your books have more than one set of details, per book?> action to display the details of a particular book (according to the > book''s mysql id). The book_details action is accessed via a link from > the books action via the following snippet: > > <a href=<%= "/browse/book_details/#{_bookID}" %> class="text11" > style="text-decoration:none"> > <%= _title %> > </a> > > where _title is properly set to the book''s title and _bookID is the > mysql id of the book. I''ve verified that _title and _bookID are set > properly. Equivalently, I''ve also used the following snippet instead > of the above: > > <%= link_to(_title, > { :controller => "browse", > :action => "book_details", > :id => _bookID > }) %>Why are you using all the underscore-prefixed _vars ? What purpose do they serve? When you get an ActiveRecord book object from the database does it not contain the book id? Why not reference it as is? @book.id or whatever.> In both of the above cases, I''m using the default route: map.connect > '':controller/:action/:id'' > In my test environment (Windows XP, Instant Rails, Aptana IDE) > everything works just fine. When I try to run this in production mode > on the ISP''s site (asmallorange.com - CentOS) the books action works > just fine but the book_details action results in the extremely > descriptive :-| error message displayed as a webpage: > > Application error > Rails application failed to start properlyIn production it''s wise to not display visible errors on the screen, which is exactly what Rails does by default.> For the life of me, I don''t see what I''m doing wrong. On the ISP site, > I set the log level to debug and compared the log files from both the > test (Windows XP) and production (CentOS) environments. The only > difference I could find is that in the CentOS production log, I see a > SQL_AUTO_IS_NULL message in the log file. I can''t figure out what this > means and am not sure how relevant it is.Google returned this as the first result when I searched: http://dev.mysql.com/doc/refman/5.0/en/set-option.html SQL_AUTO_IS_NULL = {0 | 1} If set to 1 (the default), you can find the last inserted row for a table that contains an AUTO_INCREMENT column by using the following construct: WHERE auto_increment_column IS NULL> Any suggestions are > appreciated. Should I do something special with the routes?If you app requires it, yes. I see nothing in your post to warrant any changes to the default however.> Below are the two log files. > > ===================> test environment log file that works (Windows XP) > ===================> Processing BrowseController#book_details (for 127.0.0.1 at 2008-01-21 > 14:20:22) > [GET] > Session ID: e49a3adf336e845be40dc8573f2b32c9 > Parameters: {"action"=>"book_details", "id"=>"1", > "controller"=>"browse"} > ←[4;35;1mBook Columns (0.000000)←[0m ←[0mSHOW FIELDS FROM > books←[0m > ←[4;36;1mBook Load (0.000000)←[0m ←[0;1mSELECT * FROM books WHERE > (books.`id > ` = 1) ←[0m > Rendering within layouts/browse > Rendering browse/book_details > Completed in 0.01600 (62 reqs/sec) | Rendering: 0.00000 (0%) | DB: > 0.00000 (0%) > | 200 OK [http://localhost/browse/book_details/1] > > > ===================> production environment log file that doesn''t work (CentOS) > ===================> # Logfile created on Mon Jan 21 14:29:06 -0500 2008 by / > > > Processing BrowseController#book_details (for 69.143.120.176 at > 2008-01-21 14:29 > :06) [GET] > Session ID: ded95bf9e5a23822f854e9ba58d69d6e > Parameters: {"action"=>"book_details", "id"=>"1", > "controller"=>"browse"} > ^[[4;36;1mSQL (0.000086)^[[0m ^[[0;1mSET SQL_AUTO_IS_NULL=0^[[0m > ^[[4;35;1mBook Columns (0.001176)^[[0m ^[[0mSHOW FIELDS FROM > books^[[0m > ^[[4;36;1mBook Load (0.000065)^[[0m ^[[0;1mSELECT * FROM books > WHERE (books. > `id` = 1) ^[[0m > Rendering within layouts/browse > Rendering browse/book_details > Completed in 0.06461 (15 reqs/sec) | Rendering: 0.01440 (22%) | DB: > 0.00133 (2%) > | 200 OK [http://www.epps-alford.com/browse/book_details/1]I think you will find your problem somewhere in your _var (re)assignments. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Greg, Thanks for your feedback.> I think you will find your problem somewhere in your _var (re)assignments.My style of variable name derives from coding in other languages (Java/ C++). I didn''t think that was related but switched the variables around just in case per your suggestion. Unfortunately that didn''t help. It turns out that the problem was unrelated to variable names or the SQL_AUTO_IS_NULL setting. The problem was due to a puts statement in my controller. The following action was defined in my controller: def book_details puts "ID equals #{params[:id]}" @book = Book.find(params[:id]) @pageTitle = "Epps-Alford Bookstore" end This caused the mysterious error. Things worked fine on my development machine (Windows XP, InstantRails) but crapped out in the production environment (CentOS). By removing the puts method, the action started working in the production environment on Linux/CentOS. Thanks!!! On Jan 22, 6:09 pm, "Greg Donald" <gdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/21/08, sd.codewarrior <sd.codewarr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a simple controller (browse) that uses a "books" action to > > display a list of books (stored in a mysql db) and a "book_details" > > Do your books have more than one set of details, per book? > > > > > action to display the details of a particular book (according to the > > book''s mysql id). The book_details action is accessed via a link from > > the books action via the following snippet: > > > <a href=<%= "/browse/book_details/#{_bookID}" %> class="text11" > > style="text-decoration:none"> > > <%= _title %> > > </a> > > > where _title is properly set to the book''s title and _bookID is the > > mysql id of the book. I''ve verified that _title and _bookID are set > > properly. Equivalently, I''ve also used the following snippet instead > > of the above: > > > <%= link_to(_title, > > { :controller => "browse", > > :action => "book_details", > > :id => _bookID > > }) %> > > Why are you using all the underscore-prefixed _vars ? What purpose do > they serve? > > When you get an ActiveRecord book object from the database does it not > contain the book id? Why not reference it as is? @book.id or > whatever. > > > In both of the above cases, I''m using the default route: map.connect > > '':controller/:action/:id'' > > In my test environment (Windows XP, Instant Rails, Aptana IDE) > > everything works just fine. When I try to run this in production mode > > on the ISP''s site (asmallorange.com - CentOS) the books action works > > just fine but the book_details action results in the extremely > > descriptive :-| error message displayed as a webpage: > > > Application error > > Rails application failed to start properly > > In production it''s wise to not display visible errors on the screen, > which is exactly what Rails does by default. > > > For the life of me, I don''t see what I''m doing wrong. On the ISP site, > > I set the log level to debug and compared the log files from both the > > test (Windows XP) and production (CentOS) environments. The only > > difference I could find is that in the CentOS production log, I see a > > SQL_AUTO_IS_NULL message in the log file. I can''t figure out what this > > means and am not sure how relevant it is. > > Google returned this as the first result when I searched: > > http://dev.mysql.com/doc/refman/5.0/en/set-option.html > > SQL_AUTO_IS_NULL = {0 | 1} > > If set to 1 (the default), you can find the last inserted row for a > table that contains an AUTO_INCREMENT column by using the following > construct: > > WHERE auto_increment_column IS NULL > > > Any suggestions are > > appreciated. Should I do something special with the routes? > > If you app requires it, yes. I see nothing in your post to warrant > any changes to the default however. > > > > > Below are the two log files. > > > ===================> > test environment log file that works (Windows XP) > > ===================> > Processing BrowseController#book_details (for 127.0.0.1 at 2008-01-21 > > 14:20:22) > > [GET] > > Session ID: e49a3adf336e845be40dc8573f2b32c9 > > Parameters: {"action"=>"book_details", "id"=>"1", > > "controller"=>"browse"} > > ←[4;35;1mBook Columns (0.000000)←[0m ←[0mSHOW FIELDS FROM > > books←[0m > > ←[4;36;1mBook Load (0.000000)←[0m ←[0;1mSELECT * FROM books WHERE > > (books.`id > > ` = 1) ←[0m > > Rendering within layouts/browse > > Rendering browse/book_details > > Completed in 0.01600 (62 reqs/sec) | Rendering: 0.00000 (0%) | DB: > > 0.00000 (0%) > > | 200 OK [http://localhost/browse/book_details/1] > > > ===================> > production environment log file that doesn''t work (CentOS) > > ===================> > # Logfile created on Mon Jan 21 14:29:06 -0500 2008 by / > > > Processing BrowseController#book_details (for 69.143.120.176 at > > 2008-01-21 14:29 > > :06) [GET] > > Session ID: ded95bf9e5a23822f854e9ba58d69d6e > > Parameters: {"action"=>"book_details", "id"=>"1", > > "controller"=>"browse"} > > ^[[4;36;1mSQL (0.000086)^[[0m ^[[0;1mSET SQL_AUTO_IS_NULL=0^[[0m > > ^[[4;35;1mBook Columns (0.001176)^[[0m ^[[0mSHOW FIELDS FROM > > books^[[0m > > ^[[4;36;1mBook Load (0.000065)^[[0m ^[[0;1mSELECT * FROM books > > WHERE (books. > > `id` = 1) ^[[0m > > Rendering within layouts/browse > > Rendering browse/book_details > > Completed in 0.06461 (15 reqs/sec) | Rendering: 0.01440 (22%) | DB: > > 0.00133 (2%) > > | 200 OK [http://www.epps-alford.com/browse/book_details/1] > > I think you will find your problem somewhere in your _var (re)assignments. > > -- > Greg Donaldhttp://destiney.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 -~----------~----~----~----~------~----~------~--~---