-
-
Save nicholaides/517242 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- app/views/houdini_templates/post.html.erb --> | |
<h2>Review the image for offensiveness</h2> | |
<h3>Instructions</h3> | |
<p>Please review the image below.</p> | |
<img src="<%= post.image_url %>"> | |
<p> | |
<input type="radio" name="flagged" value="yes"/> | |
Yes, this picture is offensive | |
</p> | |
<p> | |
<input type="radio" name="flagged" value="no"/> | |
No, this picture is okay | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/post.rb | |
# Additional notes for me: | |
# * change :on_submit to :after_submit | |
# * send success, errors to :after_submit instead of response, body | |
# * Use :title as :identifier? | |
# Mike's notes | |
# removed title -> I think this should be taken from "houdini :moderates_image" | |
# :on_postback could be :on_complete or :on_task_completion | |
class Post < ActiveRecord::Base | |
include Houdini::Model | |
houdini :moderates_image, | |
:price => '0.01', | |
:form_template => 'app/views/houdini_templates/post.html.erb', | |
:on_postback => :process_image_moderation_answer | |
after_create :send_to_houdini | |
def process_image_moderation_answer(params) | |
update_attributes(:flagged => (params[:flagged] == 'yes')) | |
end | |
def send_to_houdini | |
Houdini.send_to_houdini(self) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment