Rails address and routes?
Posted
by Danny McClelland
on Stack Overflow
See other posts from Stack Overflow
or by Danny McClelland
Published on 2010-05-20T14:09:09Z
Indexed on
2010/05/20
14:10 UTC
Read the original article
Hit count: 291
Hi Everyone,
I have created a custom action within one of my controlers as follows:
# GET /kases/discharge/1
# GET /kases/discharge/1.xml
def discharge
@kase = Kase.find_by_jobno(params[:id])
respond_to do |format|
format.html { } # discharge.html.erb
format.xml { render :xml => @kase }
format.pdf { render :layout => false }
prawnto :prawn => {
:background => "#{RAILS_ROOT}/public/images/discharge.png",
:left_margin => 0,
:right_margin => 0,
:top_margin => 0,
:bottom_margin => 0,
:page_size => 'A4' }
end
end
For the edit actions etc the link would be
link_to edit_kase_path(@kase)
Is there a way of linking to the discharge action already, or do I have to make a custom route?
Thanks,
Danny
© Stack Overflow or respective owner