No render in Beginning Rails 3

Hi all again,

I still working with Beginning Rails 3 book, and I’ve the following problem:

Pg. 205 Responding to Requests with :format => :js

When I try to

app/views/articles/show.html.erb

<%= render @article %>


Comments:

<%= render @article.comments %>

<%= link_to “new comment”, new_article_comment_path(@article, :format => :js),

:remote => true, :id => ‘new_comment_link’ %>

app/views/comments/new.js.erb:

$("<%= escape_javascript render(:file => ‘comments/new.html.erb’) %>").insertAfter(’#comments’);

$(’#new_comment_link’).hide();

When I click on the “New comment” link, this page is render:

http://localhost:3000/articles/1/comments/new.js

$("<form accept-charset=\"UTF-8\" action=\"/articles/1/comments\" class=\"new_comment\" id=\"new_comment\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"Iom91p0FDuTiQRuj1EFz4iexBuditCIzJBq2cazFniQ=\" /><\/div>\n\n<div>\n <h3>Create new comment<\/h3>\n <p>\n <label for=\"comment_name\">Name<\/label><input id=\"comment_name\" name=\"comment[name]\" size=\"30\" type=\"text\" /><br/>\n <label for=\"comment_email\">Email<\/label><input id=\"comment_email\" name=\"comment[email]\" size=\"30\" type=\"text\" /><br/>\n <label for=\"comment_body\">Body<\/label><textarea cols=\"40\" id=\"comment_body\" name=\"comment[body]\" rows=\"20\"><\/textarea>\n <\/p>\n <p>\n <input id=\"comment_submit\" name=\"commit\" type=\"submit\" value=\"Add\" />\n <\/p>\n<\/div>\n<\/form>").insertAfter('#comments');
$('#new_comment_link').hide();


I downloaded rails.js and jquery-1.4.4.min.js file, I think it’s a problem with my JavaScript files or something.

Please I’ll really appreciate your help.

Regards,

blog.rar (93.7 KB)

Hi Amador,

The jquery-1.4.4.min.js file you have is broken. Try this one instead:
http://code.jquery.com/jquery-1.4.4.min.js

Cheers,

Thanks, I didn’t notice that.

Regards,