Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## view / form
- # form_remote_tag is posted before this code.
- <table>
- <tr>
- <td class='CommentColumn'></td>
- <td id='Loading<%=elements.id%>'
- style='display : none; font-weight : bold; text-align : center;
- width : 270px;'>Loading</td>
- </tr>
- <tr>
- <td class='CommentColumn'></td>
- <td id='CommentResponse<%=elements.id%>'
- style='font-weight : bold; text-align : center;
- width : 270px;'></td>
- </tr>
- <tr>
- <td class='CommentColumn'>Subject :</td>
- <td><%=text_field "comments", "name", { :class => 'form' } %>
- </tr>
- <tr>
- <td class='CommentColumn'>Name/Alias :</td>
- <td><%=text_field "comments", "title", { :class => 'form' } %>
- </tr>
- <tr>
- <td class='CommentColumn' valign="top">Comment :</td>
- <td><%= text_area "comments", "comment", { :class => 'CommentTextArea' } %>
- </tr>
- <%= hidden_field "comments", "blogid", { :value => elements.id } %>
- <tr>
- <td> </td>
- <td> <%= submit_tag "Post ya comment!" %> </td>
- </tr>
- </table>
- ## model
- class Comments < ActiveRecord::Base
- validates_presence_of :name
- validates_presence_of :title
- validates_presence_of :comment
- end
- ## view that is rendered after ajax request
- hi
- <%= error_messages_for 'Comments' %>
- ## controller
- def postcomment
- @comment = Comments.new( params[:comments])
- if @comment.valid?
- # render page..
- else
- render :partial => 'users/themes/geek/comments_error.html.erb'
- end
- end
Add Comment
Please, Sign In to add comment