I have the Beta2 Rails book, and am working through the Store example.
On page 103, I have just added the checkout function.  After getting the
checkout page at http://localhost:3000/store/checkout, I click the
CHECKOUT button with all fields empty.  Instead of the page''s being
redisplayed with error messages, I get:
------------------------------------------------------------------------
ActionView::ActionViewError in Store#save_order
No rhtml, rxml, or delegate template found for actioncheckout
app/controllers/store_controller.rb:43:in `save_order''
script/server:48
Show framework trace 
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_view/base.rb:213:in
`pick_template_extension''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_view/base.rb:171:in
`render_file''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/layout.rb:208:in
`render_without_benchmark''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`render''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`measure''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`render''
Parameters: {"order"=>{"name"=>"",
"pay_type"=>"", "address"=>"",
"email"=>""}}
Show session dump
--- 
flash: !ruby/hash:ActionController::Flash::FlashHash {}
:cart: !ruby/object:Cart 
  items: 
    - !ruby/object:LineItem 
      attributes: 
        order_id: 
        product_id: 1
        quantity: 1
        unit_price: 1.0
      new_record: true
      product: !ruby/object:Product 
        attributes: 
          image_url: http:a.jpg
          date_available: 2005-06-13 15:53:00
          price: "1.00"
          title: a
          id: "1"
          description: a
    - !ruby/object:LineItem 
      attributes: 
        order_id: 
        product_id: 2
        quantity: 1
        unit_price: 2.0
      new_record: true
      product: !ruby/object:Product 
        attributes: 
          image_url: http:b.jpg
          date_available: 2005-06-13 15:53:00
          price: "2.00"
          title: b
          id: "2"
          description: b
  total_price: 3.0
Response
Headers: {"cookie"=>[],
"Cache-Control"=>"no-cache"}
------------------------------------------------
The store_controller.rb section being invoked is:
  def checkout
    @items = cart.items
    if @items.empty?
      redirect_to_index("There''s nothing in your cart!")
    else
      @order = Order.new
    end
  end
  def save_order
    @order = Order.new(params[:order])
    @order.line_items << cart.items
    if @order.save
      cart.empty!
      redirect_to_index(''Thank you for your order.'')
    else
      render(:action => ''checkout'')
    end
  end
Line 43, referenced in the error message is the render(:action =>
''checkout'') statement.  If I enter data in all the required
fields, the
order is saved.
Can anyone tell me what I am doing wrong?
Thank you.
-- 
Jim McMaster
mailto:jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org
Jim
I had the same problem using Rails 0.12.1, and changed the last line
(inside the else block) in save_order to
render_action(''checkout'').
I read somewhere, can''t recall where - that the next version of Rails
will use token args for a lot of render methods, but I don''t think
they work in 0.12.1 (at least not in my win32 env).
Hope that helps
Erik
----
Message: 8
Date: Mon, 13 Jun 2005 16:44:55 -0600
From: Jim McMaster <jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org>
Subject: [Rails] Problem with Rails book
To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Message-ID: <1118702695.12267.63.camel@dev14dt>
Content-Type: text/plain
I have the Beta2 Rails book, and am working through the Store example.
On page 103, I have just added the checkout function.  After getting the
checkout page at http://localhost:3000/store/checkout, I click the
CHECKOUT button with all fields empty.  Instead of the page''s being
redisplayed with error messages, I get:
------------------------------------------------------------------------
ActionView::ActionViewError in Store#save_order
No rhtml, rxml, or delegate template found for actioncheckout
app/controllers/store_controller.rb:43:in `save_order''
script/server:48
Show framework trace
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_view/base.rb:213:in
`pick_template_extension''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_view/base.rb:171:in
`render_file''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/layout.rb:208:in
`render_without_benchmark''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`render''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`measure''
/usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in
`render''
Parameters: {"order"=>{"name"=>"",
"pay_type"=>"", "address"=>"",
"email"=>""}}
Show session dump
---
flash: !ruby/hash:ActionController::Flash::FlashHash {}
:cart: !ruby/object:Cart
 items:
   - !ruby/object:LineItem
     attributes:
       order_id:
       product_id: 1
       quantity: 1
       unit_price: 1.0
     new_record: true
     product: !ruby/object:Product
       attributes:
         image_url: http:a.jpg
         date_available: 2005-06-13 15:53:00
         price: "1.00"
         title: a
         id: "1"
         description: a
   - !ruby/object:LineItem
     attributes:
       order_id:
       product_id: 2
       quantity: 1
       unit_price: 2.0
     new_record: true
     product: !ruby/object:Product
       attributes:
         image_url: http:b.jpg
         date_available: 2005-06-13 15:53:00
         price: "2.00"
         title: b
         id: "2"
         description: b
 total_price: 3.0
Response
Headers: {"cookie"=>[],
"Cache-Control"=>"no-cache"}
------------------------------------------------
The store_controller.rb section being invoked is:
 def checkout
   @items = cart.items
   if @items.empty?
     redirect_to_index("There''s nothing in your cart!")
   else
     @order = Order.new
   end
 end
 def save_order
   @order = Order.new(params[:order])
   @order.line_items << cart.items
   if @order.save
     cart.empty!
     redirect_to_index(''Thank you for your order.'')
   else
     render(:action => ''checkout'')
   end
 end
Line 43, referenced in the error message is the render(:action =>
''checkout'') statement.  If I enter data in all the required
fields, the
order is saved.
Can anyone tell me what I am doing wrong?
Thank you.
--
Jim McMaster
mailto:jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org
On Mon, 2005-06-13 at 23:58 +0100, Erik Eide wrote:> Jim > > I had the same problem using Rails 0.12.1, and changed the last line > (inside the else block) in save_order to render_action(''checkout''). > > I read somewhere, can''t recall where - that the next version of Rails > will use token args for a lot of render methods, but I don''t think > they work in 0.12.1 (at least not in my win32 env). > > Hope that helps > Erik >That was indeed the problem. Thank you. I now have a similar issue on the "render(layout => false)" line. I get no template for layoutfalse. Does anyone have a solution for that? -- Jim McMaster mailto:jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org
Hi Jim I think it might be the same deal, check the rdoc on actionpack and you should find the existing (or old style) method calls. For render(:layout => false) I''ve used render_without_layout Cheers Erik On 6/14/05, Jim McMaster <jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org> wrote:> On Mon, 2005-06-13 at 23:58 +0100, Erik Eide wrote: > > Jim > > > > I had the same problem using Rails 0.12.1, and changed the last line > > (inside the else block) in save_order to render_action(''checkout''). > > > > I read somewhere, can''t recall where - that the next version of Rails > > will use token args for a lot of render methods, but I don''t think > > they work in 0.12.1 (at least not in my win32 env). > > > > Hope that helps > > Erik > > > That was indeed the problem. Thank you. > > I now have a similar issue on the "render(layout => false)" line. I get > no template for layoutfalse. Does anyone have a solution for that? > -- > Jim McMaster > mailto:jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org > >
Jim McMaster wrote:> I have the Beta2 Rails book, and am working through the Store example. > On page 103, I have just added the checkout function. After getting the > checkout page at http://localhost:3000/store/checkout, I click the > CHECKOUT button with all fields empty. Instead of the page''s being > redisplayed with error messages, I get: > ------------------------------------------------------------------------ > ActionView::ActionViewError in Store#save_order > No rhtml, rxml, or delegate template found for actioncheckout > app/controllers/store_controller.rb:43:in `save_order''[snip] Jim, to use the code examples in the Beta 2 book, I suggest you work with the Rails beta gems. The Beta 1 book was fine with Rails 0.12.1 (at least as far as I got before Beta 2 came out), but the second beta goes beyond that. Do this: > gem update --source http://gems.rubyonrails.org regards Justin
On Mon, 2005-06-13 at 23:58 +0100, Erik Eide wrote:> Jim > > I had the same problem using Rails 0.12.1, and changed the last line > (inside the else block) in save_order to render_action(''checkout''). > > I read somewhere, can''t recall where - that the next version of Rails > will use token args for a lot of render methods, but I don''t think > they work in 0.12.1 (at least not in my win32 env). >That did indeed solve the problem. Thank you. -- Jim McMaster mailto:jmcmaster-VsM5TWebDq2iu113P13oHA@public.gmane.org
Thanks, Erik. This helped me as well. Erik Eide <erik.eide@...> writes:> > Hi Jim > > I think it might be the same deal, check the rdoc on actionpack and > you should find the existing (or old style) method calls. For > render(:layout => false) I''ve used render_without_layout > > Cheers > Erik<snip>