Sha256: 3ca602bd62e8ccc21d2595e7a26ed3bd3849b8ae3077d525bb813b249c4d1ae0

Contents?: true

Size: 692 Bytes

Versions: 15

Compression:

Stored size: 692 Bytes

Contents

module WepayRails
  module Helpers
    module ModelHelpers

      # Create a column on one of your models where the wepay authorization code
      # will be stored to be used for future transactions. Example:

      # add_column :users, :wepay_auth_code, :string

      # Then in your model, let's say the User model, you tell wepay-rails what the column name is:
      #
      # class User < ActiveRecord::Base
      #   wepayable :wepay_auth_code
      # end
      def wepayable(*args)
        @params = args.last if args.last.is_a?(Hash)
        @column = args.first.to_s

        define_method "has_#{@column}?" do
          "#{@column}.present?"
        end
      end


    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wepay-rails-0.1.23 lib/helpers/model_helpers.rb
wepay-rails-0.1.22 lib/helpers/model_helpers.rb
wepay-rails-0.1.21 lib/helpers/model_helpers.rb
wepay-rails-0.1.20 lib/helpers/model_helpers.rb
wepay-rails-0.1.19 lib/helpers/model_helpers.rb
wepay-rails-0.1.18 lib/helpers/model_helpers.rb
wepay-rails-0.1.17 lib/helpers/model_helpers.rb
wepay-rails-0.1.16 lib/helpers/model_helpers.rb
wepay-rails-0.1.15 lib/helpers/model_helpers.rb
wepay-rails-0.1.14 lib/helpers/model_helpers.rb
wepay-rails-0.1.13 lib/helpers/model_helpers.rb
wepay-rails-0.1.12 lib/helpers/model_helpers.rb
wepay-rails-0.1.11 lib/helpers/model_helpers.rb
wepay-rails-0.1.10 lib/helpers/model_helpers.rb
wepay-rails-0.1.9 lib/helpers/model_helpers.rb