hobo_render missing, how to do wants.xml

3 vistas
Ir al primer mensaje no leído

Steve DeBaun

no leída,
10 sept 2008, 8:28:49 p.m.10/9/2008
para Hobo Users
I saw a post from last year, explaining how to do wants.xml in a hobo
method. It no longer works. I can't find hobo_render anywhere, and
it looks like the behavior for hobo_show &block has changed. How
should I do this now?

--- from post: ---

It's not a hobo feature as such, but you can do it easily. Pass a
block to the hobo action, and you have total control over the
response. Vars like @this will be ready to use

e.g. on show

def show
hobo_show do
respond_to do |wants|
wants.html do
hobo_render
end
wants.xml do
# up to you
end
end
end

Tom Locke

no leída,
11 sept 2008, 9:26:08 a.m.11/9/2008
para hobo...@googlegroups.com
def show
hobo_show do |format|
format.xml? do
...
end
format.html? do
# leave this to Hobo
end
end
end

Unfortunately that empty .html? block is required otherwise the html
repsonse breaks. You need to do the same with .js? if you want the
ajax stuff to work. Will look into how to avoid that in the future.

Tom

Niko

no leída,
28 oct 2008, 3:25:07 a.m.28/10/2008
para Hobo Users
On Sep 11, 2:26 pm, Tom Locke <t...@tomlocke.com> wrote:
> def show
> hobo_showdo |format|
Hi Tom,

I tried to render XML from the sample advert controller with the
latest and greatest hobo, but it seems to not working that way:

=========================================
class AdvertsController < ApplicationController

hobo_model_controller

auto_actions :all

def show
hobo_show do |format|
format.xml? do
@advert = Advert.find params[:id]
render :xml => @advert
end
format.html? do
# leave this to Hobo
end
end
end

end
=========================================

But the result is:

=========================================
NameError in AdvertsController#show
wrong constant name HTML?

/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/
mime_responds.rb:146:in `const_get'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/
mime_responds.rb:146:in `method_missing'
app/controllers/adverts_controller.rb:13:in `show'
/Library/Ruby/Gems/1.8/gems/hobo-0.8.3/lib/hobo/model_controller.rb:
407:in `response_block'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/
mime_responds.rb:106:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/
mime_responds.rb:106:in `respond_to'
/Library/Ruby/Gems/1.8/gems/hobo-0.8.3/lib/hobo/model_controller.rb:
407:in `response_block'
/Library/Ruby/Gems/1.8/gems/hobo-0.8.3/lib/hobo/model_controller.rb:
467:in `hobo_show'
app/controllers/adverts_controller.rb:8:in `show'
=========================================

Since I am hobo newbie, any help is very appreciated.

Thanks,
Niko

Tom Locke

no leída,
28 oct 2008, 4:34:17 a.m.28/10/2008
para hobo...@googlegroups.com
> NameError in AdvertsController#show
> wrong constant name HTML?

Hmmm - no idea what that's about. I'll investigate

Tom

Tom Locke

no leída,
3 nov 2008, 11:35:55 a.m.3/11/2008
para hobo...@googlegroups.com
> I tried to render XML from the sample advert controller with the
> latest and greatest hobo, but it seems to not working that way:
>
> hobo_show do |format|
> format.xml? do

There shouldn't be a ? on format.xml

-Tom

Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos