I''ve just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), and have a few parts of it built out. I''ve just created new controller/views using rails g scaffold_controller Lesson, and then added a route to routes.rb with "resources :lessons" Now, when i go to /lessons, Webrick fails with "Illegal instruction" The controller function getting hit is lessons#index, and looks like this: # GET /lessons # GET /lessons.xml def index @lessons = Lesson.all respond_to do |format| format.html index.html.erb format.xml { render :xml => @lessons } end end If i comment out the respond_to section, the index page renders fine with no crashing. I have no idea what I could have done to make it begin to crash with respond_to? This is the first time i''ve used "resources" in my app. What can I do to even start to debug this issue? Thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
With additional testing I''ve found that anywhere i put format.html in a respond_to block, I get the same error. Any thoughts on how I can start to track this down? Ben Porterfield wrote in post #960026:> I''ve just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), > and have a few parts of it built out. I''ve just created new > controller/views using rails g scaffold_controller Lesson, and then > added a route to routes.rb with "resources :lessons" > > Now, when i go to /lessons, Webrick fails with "Illegal instruction" > > The controller function getting hit is lessons#index, and looks like > this: > > # GET /lessons > # GET /lessons.xml > def index > @lessons = Lesson.all > > respond_to do |format| > format.html index.html.erb > format.xml { render :xml => @lessons } > end > end > > If i comment out the respond_to section, the index page renders fine > with no crashing. I have no idea what I could have done to make it begin > to crash with respond_to? This is the first time i''ve used "resources" > in my app. What can I do to even start to debug this issue? Thanks!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Just drop the index.html.erb part so your block looks like this: respond_to do |format| format.html format.xml { render :xml => @lessons } end index.html.erb will already be inferred from the action name, and if you do want to set it to something different, you would say respond_to do |format| format.html { render :template => ''/foo/bar'' } format.xml { render :xml => @lessons } end Walter On Nov 7, 2010, at 9:11 PM, Ben Porterfield wrote:> With additional testing I''ve found that anywhere i put format.html > in a > respond_to block, I get the same error. Any thoughts on how I can > start > to track this down? > > Ben Porterfield wrote in post #960026: >> I''ve just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS >> X), >> and have a few parts of it built out. I''ve just created new >> controller/views using rails g scaffold_controller Lesson, and then >> added a route to routes.rb with "resources :lessons" >> >> Now, when i go to /lessons, Webrick fails with "Illegal instruction" >> >> The controller function getting hit is lessons#index, and looks like >> this: >> >> # GET /lessons >> # GET /lessons.xml >> def index >> @lessons = Lesson.all >> >> respond_to do |format| >> format.html index.html.erb >> format.xml { render :xml => @lessons } >> end >> end >> >> If i comment out the respond_to section, the index page renders fine >> with no crashing. I have no idea what I could have done to make it >> begin >> to crash with respond_to? This is the first time i''ve used >> "resources" >> in my app. What can I do to even start to debug this issue? Thanks! > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 > . >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Awesome, this did indeed fix the problem! However, I didn''t write the format code - this code was generated with: rails g scaffold_controller Lessons Which leads me to believe that this is the proper format code....3.0.1 generates "format.html {filename}.html.erb" for each controller function - is this a generator bug, or do I have a problem with my system? Walter Davis wrote in post #960032:> Just drop the index.html.erb part so your block looks like this: > > respond_to do |format| > format.html > format.xml { render :xml => @lessons } > end > > index.html.erb will already be inferred from the action name, and if > you do want to set it to something different, you would say > > respond_to do |format| > format.html { render :template => ''/foo/bar'' } > format.xml { render :xml => @lessons } > end > > Walter-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2010-Nov-08 12:43 UTC
Re: Re: Re: Webrick Failing with Illegal Instruction
That may indeed be the new Rails 3 syntax, I haven''t spent any time with that yet, so sorry if I led you astray. But I suspect your problems began when you used the plural name for your scaffold argument. Try again, using rails g scaffold_controller Lesson and see if there is a different output. Walter On Nov 7, 2010, at 10:03 PM, Ben Porterfield wrote:> Awesome, this did indeed fix the problem! > > However, I didn''t write the format code - this code was generated > with: > > rails g scaffold_controller Lessons > > Which leads me to believe that this is the proper format code....3.0.1 > generates "format.html {filename}.html.erb" for each controller > function > - is this a generator bug, or do I have a problem with my system? > > Walter Davis wrote in post #960032: >> Just drop the index.html.erb part so your block looks like this: >> >> respond_to do |format| >> format.html >> format.xml { render :xml => @lessons } >> end >> >> index.html.erb will already be inferred from the action name, and if >> you do want to set it to something different, you would say >> >> respond_to do |format| >> format.html { render :template => ''/foo/bar'' } >> format.xml { render :xml => @lessons } >> end >> >> Walter > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 > . >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ben Porterfield
2010-Nov-09 03:37 UTC
Re: Re: Re: Webrick Failing with Illegal Instruction
It''s even simpler than that. Chalk it up to a rails newbie - sorry for the bother. Here''s what I did: Rails generated this: # GET /appointments/1 # GET /appointments/1.xml def show @appointment = Appointment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @appointment } end end I had made a few changes, but then was undoing them - I must have thought that I had made those comments after format.html and uncommented them myself.Bah! Walter Davis wrote in post #960107:> That may indeed be the new Rails 3 syntax, I haven''t spent any time > with that yet, so sorry if I led you astray. But I suspect your > problems began when you used the plural name for your scaffold > argument. Try again, using rails g scaffold_controller Lesson and see > if there is a different output. > > Walter-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Nov 7, 2010 at 7:51 PM, Ben Porterfield <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> I''ve just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), > and have a few parts of it built out. I''ve just created new > controller/views using rails g scaffold_controller Lesson, and then > added a route to routes.rb with "resources :lessons" > > Now, when i go to /lessons, Webrick fails with "Illegal instruction" > > The controller function getting hit is lessons#index, and looks like > this: > > # GET /lessons > # GET /lessons.xml > def index > @lessons = Lesson.all > > respond_to do |format| > format.html index.html.erb > format.xml { render :xml => @lessons } > end >I think you need to comment out index.html.erb... should not be there, or if you want to specify it, it should be a string or something like { render :action => "index" }: respond_to do |format| format.html #index.html.erb format.xml { render :xml => @lessons } end> end > > If i comment out the respond_to section, the index page renders fine > with no crashing. I have no idea what I could have done to make it begin > to crash with respond_to? This is the first time i''ve used "resources" > in my app. What can I do to even start to debug this issue? Thanks! > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Nov 8, 2010 at 9:46 PM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> > > On Sun, Nov 7, 2010 at 7:51 PM, Ben Porterfield <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote: > >> I''ve just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), >> and have a few parts of it built out. I''ve just created new >> controller/views using rails g scaffold_controller Lesson, and then >> added a route to routes.rb with "resources :lessons" >> >> Now, when i go to /lessons, Webrick fails with "Illegal instruction" >> >> The controller function getting hit is lessons#index, and looks like >> this: >> >> # GET /lessons >> # GET /lessons.xml >> def index >> @lessons = Lesson.all >> >> respond_to do |format| >> format.html index.html.erb >> format.xml { render :xml => @lessons } >> end >> > > I think you need to comment out index.html.erb... should not be there, or > if you want to specify it, it should be a string or something like { render > :action => "index" }: > > > respond_to do |format| > format.html #index.html.erb > format.xml { render :xml => @lessons } > end > >Oops... did not see that this already got responses.> end >> >> If i comment out the respond_to section, the index page renders fine >> with no crashing. I have no idea what I could have done to make it begin >> to crash with respond_to? This is the first time i''ve used "resources" >> in my app. What can I do to even start to debug this issue? Thanks! >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.