Cleaning and Drying up controllers with postback actions

Hello,

I am trying to clean and dry up my controllers with my postbacks with
the following code in my controller:

def edit
@music = Music.find_by_id(params[:id]) || Music.new
if request.post?
@music.attributes = params[:music]
redirect_to :controller => ‘client’, :action => ‘show’, :id =>
session[:client] and return if @music.save
end
end

Now when I create a new album, it works fine, but when I try to edit it,
this is the error I get:

no route found to match “/music/edit/edit/3”

Why isn’t my code doing my edit properly?

Thanks,
M

you might want to skip this recipe, since it no longer applies for
RESTful routes… New and edit now use separate actions…

Mike

Mike G. wrote:

you might want to skip this recipe, since it no longer applies for
RESTful routes… New and edit now use separate actions…

Mike

Oh ok thanks.