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- [email protected]. To unsubscribe from this group, send email to [email protected] . 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to