Skip to content

Instantly share code, notes, and snippets.

View johnmcaliley's full-sized avatar

John McAliley johnmcaliley

View GitHub Profile
require "my_gem"
require "rails"
module MyGem
class Engine < Rails::Engine
initializer 'ar_extension' do |app|
ActiveRecord::Base.extend MyGem::SomeThing
end
end
end
require 'rails'
require 'my_gem'
module MyGem
class Railtie < Rails::Railtie
initializer "my_gem.setup!", :before=>"some_initializer" do |app|
MyGem.setup!
end
end
end
source "http://www.rubygems.org"
gemspec
module MyGem
module VERSION
MAJOR = 3
MINOR = 1
TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
end
module MyGem
module VERSION
MAJOR = 3
MINOR = 1
TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
end
Gem::Specification.new do |s|
s.name = %q{my_gem}
s.version = "0.0.0"
s.date = %q{2011-09-17}
s.require_paths = ["lib"]
s.summary = %q{TODO: one-line summary of your gem}
s.files = [
".document",
"Gemfile",
"LICENSE.txt",
=f.input :my_input, :label=>"My Label", :as => :string, :hint => "My Hint", :extra_html=>my_extra_content, :extra_html_class=>"extra-content-class", :extra_html_position=>0
=f.input :my_input, :label=>"My Label", :as => :string, :hint => "My Hint", :extra_html=>my_extra_content, :extra_html_class=>"extra-content-class"
[template.capture(&block), error_html, hint_html].join(“\n”).html_safe
module Formtastic
module Inputs
module Base
module Html
def extra_html
template.content_tag(:div, Formtastic::Util.html_safe(extra_html_text),:class => (options[:extra_html_class] || 'extra-html')) if extra_html?
end
def extra_html?
extra_html_text.present? && !extra_html_text.kind_of?(Hash)