TAILIEUCHUNG - railsspace building a social networking website with ruby on rails phần 10

Nhiệm vụ bình luận ở trên cùng của tạo đảm bảo rằng bản sao? có tất cả các id nó cần (Mục ) 0,8 RJS trong trường hợp này phục hồi liên kết "Thêm một lời" bằng cách sử dụng (nghịch đảo của ) trong khi thay thế HTML trong div ý kiến với kết quả trong việc xử lý | Simpo PDF Merge and Split Unregistered Version - http Beginning Ajax 491 Listing app controllers def create comment params comment session user_id post respond_to do format if or comment do render update do page comments_for_post_ partial comments comment collection add_comment_link_for_post_ new_comment_form_for_post_ end end else render nothing true end end end The comment assignments at the top of create ensure that duplicate has all the ids it needs Section .8 The RJS in this case restores the Add a comment link using the inverse of while replacing the HTML in the comments div with the result of rendering all of the comments again. A second possibility would be to use bottom comments_for_post_ partial comments comment to insert the new comment at the bottom of the comments list Figure . The reason we elected to rerender all the comments is because someone else might have submitted a comment while we were filling out ours this way each user always gets to see all the comments. In the case of an invalid comment . a blank body we still need something to respond to the request. Since keeping the form on the page is a sensible behavior we can just render nothing with render nothing true 8 As a result we could actually replace the array append operation comment with a simple but we find the former more suggestive. Simpo PDF Merge and Split Unregistered Version - http 492 Chapter 16 Blog comments with Ajax Figure The form goes away and the comment shows up. This silent error assumes that the user can figure out the problem if he tries to submit a blank Destroying comments From the typical user s point of view comments .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.