Skip to content

Commit

Permalink
Bumped version up
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Mar 11, 2009
1 parent bb5c42c commit f2055fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion acts_as_fu.gemspec
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = %q{acts_as_fu}
s.version = "0.0.3"
s.version = "0.0.4"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Pat Nakajima"]
Expand Down
22 changes: 11 additions & 11 deletions lib/acts_as_fu/base.rb
Expand Up @@ -17,24 +17,24 @@ def self.connect!(config={})
self.establish_connection(config)
end
end

def build_model(name, options={}, &block)
connect! unless connected?

super_class = options[:superclass] || begin
ActsAsFu::Connection.connection.create_table(name, :force => true) { }
ActsAsFu::Connection
end

set_class!(name, super_class, &block)
end

private

def set_class!(name, super_class, &block)
klass_name = name.to_s.classify
Object.send(:remove_const, klass_name) rescue nil

klass = Class.new(super_class)
Object.const_set(klass_name, klass)

Expand All @@ -49,24 +49,24 @@ def connect!
})
ActsAsFu::Connection.connected = true
end

def connected?
ActsAsFu::Connection.connected
end

def model_eval(klass, &block)
class << klass
def method_missing_with_columns(sym, *args, &block)
ActsAsFu::Connection.connection.change_table(name.tableize) do |t|
t.send(sym, *args)
end
end

alias_method_chain :method_missing, :columns
end

klass.class_eval(&block) if block_given?

class << klass
alias_method :method_missing, :method_missing_without_columns
end
Expand Down

0 comments on commit f2055fc

Please sign in to comment.