Steve Ross wrote:
> On Aug 16, 2009, at 3:01 PM, Philip Gavrilos wrote:
>
>> SyntaxError
>> include SimpleCaptcha::ControllerHelpers
>>
>> def create
>> if simple_captcha_valid?
>> @post = Post.find(params[:post_id])
>> @comment = @post.comments.create!(params[:comment])
>> respond_to do |format|
>> format.html { redirect_to @post }
>> format.js
>> end # respond_to
>
> # Move the else out of the respond_to block. If you redo your
> indentation, it will become more obvious.
>> else
>> flash[:notice] = "please right down the image verification"
>> end # if
i change to this:
class CommentsController < ApplicationController
include SimpleCaptcha::ControllerHelpers
def create
if simple_captcha_valid?
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])
respond_to do |format|
format.html { redirect_to @post }
format.js
end
else
flash[:notice] = "please right down the image verification"
end
end
end
( i post and create js also)
page.insert_html :bottom, :comments, :partial => @comment
pa...@comment].visual_effect :highlight
page[:new_comment].reset
but now if post the comment with right capcha everything is ok
but if im wrong i have js error on my code (browser popups) before
flash[:notice] = "please right down the image verification"
any suggestion ?
thanks for your help guys !
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---