Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####_Ajax_form.html
- <table>
- <% @comment = Comment.new
- #@comment.link=@link
- %>
- <% remote_form_for([@link,@comment]) do |f| %>
- <tr>
- <td><label for="comment_name" >Name</label></td>
- <td><%= f.text_field :name %></td>
- </tr>
- <tr>
- <td><label for="comment_email" >Email (optional)</label></td>
- <td><%= f.text_field :email %></td>
- </tr>
- <tr>
- <td><label for="comment_comment" /></td>
- <td><%= f.text_area :comment %></td>
- </tr>
- <tr>
- <td></td>
- <td><%= f.submit "Create" %><td>
- </tr>
- <% end %>
- ######## Controller : comments_controller
- def create
- @tempComment = params[@comment]
- @comment = Comment.new
- @comment.comment =@tempComment.comment
- #@comment.link=@link
- #if verify_recaptcha
- if @comment.save
- respond_to do |format|
- format.html do
- flash[:notice] = 'Comment was successfully created.'
- redirect_to link_path(@link)
- end
- format.js do
- render :update do |page|
- page.insert_html :bottom, 'comments', :partial =>'links/comments',:locals => { :comment => @comment }
- page.visual_effect :highlight, 'comments'
- end
- end
- end
- else
- format.html { render :action => "new" }
- end
- end
Add Comment
Please, Sign In to add comment