Getting the response body

Hi,

In my view I have

link_to_remote(image_tag(“trashcan.gif”), :url=>{:action=>‘destroy’,
:id=>jobtype.id}, :confirm=>I18n.t(:confirm_action),
:success=>"$(‘el_#{jobtype.id}’).fade()", :failure=>“alert(‘HERE I WANT
THE TEXT GENERATED BY THE CONTROLLER’)”)

And in the controller:
def destroy
id = params[:id]
render(:text=>“THIS TEXT”, :status=>:forbidden) and return if
Job.find(:all, :conditions=>[“type_id=?”,id]).size > 0
JobType.destroy(id)
render(:nothing=>true)
end

How can I get the text rendered by the controller ?

response[‘body’] can not be used here.

Thanks,
Mickael.

Hey,

Why not try:

def destroy
id = params[:id]
render :update do |page|
page.alert( “THIS TEXT” ) if Job.find(:all, :conditions=>
[“type_id=?”,id]).size > 0
end
end

Gavin

On Jul 14, 7:21 pm, Mickael Faivre-Macon <rails-mailing-l…@andreas-

forgot to add the .destroy() call there :S

Great Gavin, thanks !

Gavin M. wrote:

Why not try:

def destroy
id = params[:id]
render :update do |page|
page.alert( “THIS TEXT” ) if Job.find(:all, :conditions=>
[“type_id=?”,id]).size > 0
end
end