Sha256: b0ffbdc756e9628c4945285f5b826af3b4076c38c318ed7e0614c5da978e5f7b

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

class FlatulentController < ApplicationController
  $:.unshift '../../lib'
  load 'flatulent.rb'
  #require 'flatulent.rb'

  def figlet
    render :text => Flatulent.figlet(params), :content_type => 'text/plain'
  end

  def element 
    render :text => Flatulent.element(params)
  end

  def form_tags 
    render :text => Flatulent.form_tags(params)
  end
  alias_method 'captcha', 'form_tags'

  def form 
    if params.has_key? 'flatulent'
      valid =
        begin
          Flatulent.validate! params
          true
        rescue Flatulent::Error
          false
        end
    end

    render :inline => <<-html
      <html><body>
        valid? : #{ valid.inspect } <hr> <hr>
        #{ Flatulent.form }
        <hr> <hr> <a href="./">new</a>
      </body></html>
    html
  end
  alias_method 'index', 'form'
  alias_method 'test', 'form'

  

  def ajax 
    if params.has_key? 'flatulent'
      valid =
        begin
          Flatulent.validate! params
          true
        rescue Flatulent::Error
          false
        end
    end

    render :inline => <<-html
      <html>
        <title>Stank Thang</title>
        <head>
          <%= javascript_include_tag 'prototype' %>
        </head>
        <body>
          captcha'd? : #{ valid } <hr> <hr>
          
          <form action='./' method='post'>
            <%= Flatulent.ajax %>

            <hr>
            <input type='submit' name='submit' value='submit' />
          </form>

          <hr> <a href="./">new</a>
        </body>
      </html>
    html
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flatulent-0.0.2 rails/app/controllers/flatulent_controller.rb
flatulent-0.0.3 rails/app/controllers/flatulent_controller.rb