Hi,
I have a link_to_remote to render the edit action of an object. But all it does is update the Dom Element with this response
try { } catch (e) { alert('RJS error:\n\n' + e.toString()); alert(''); throw e }
My link looks like this:
= link_to_remote t("txt.edit"), :update => dom_id(comment), :url => edit_comment_path(comment.id)
My edit action in the comment controller:
# GET /comments/1/edit
def edit
@comment = Comment.find(params[:id])
respond_to do |format|
format.html
format.js { render :action => "edit" }
end
end
The request seems to be ok, according to the log:
Processing CommentsController#edit (for 127.0.0.1 at 2009-04-08 18:55:36) [GET]
Session ID: 1d4b9b3d3319d5cd556d00d2e053b651
Parameters: {"authenticity_token"=>"5d70f9e5beded361ee7e87ee591512411e8f3eec", "id"=>"18"}
User Columns (2.0ms) SHOW FIELDS FROM `users`
User Load (0.5ms) SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Account Columns (1.6ms) SHOW FIELDS FROM `accounts`
Account Load (0.2ms) SELECT * FROM `accounts` WHERE (`accounts`.`subdomain` = 'xxx') LIMIT 1
Comment Columns (1.7ms) SHOW FIELDS FROM `comments`
Comment Load (0.6ms) SELECT * FROM `comments` WHERE (`comments`.`id` = 18)
Rendering comments/edit
Completed in 30818ms (View: 2, DB: 7) | 200 OK [http://xx.xxx.rails/comments/18/edit?authenticity_token=5d70f9e5beded361ee7e87ee591512411e8f3eec]
What am I doing wrong? Thanks for the help!
UPDATE: It works by the way with a RJS template - that's how I solved it now. But I still prefer a solution where a view is rendered. Otherwise I have to create a partial just for this purpose (I cannot render Views with rjs page updates - at least I don't know how).