formula 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/formula.rb +27 -1
  2. data/lib/formula/railtie.rb +1 -0
  3. metadata +2 -2
data/lib/formula.rb CHANGED
@@ -4,9 +4,35 @@ module Formula
4
4
 
5
5
  class FormulaFormBuilder < ActionView::Helpers::FormBuilder
6
6
 
7
- def input(method, options = {})
7
+ def input(method, options = {}, &block)
8
8
  end
9
+
10
+ def association(method, options = {}, &block)
11
+ end
12
+
13
+ def formula_fields_for(record_or_name_or_array, *args, &block)
14
+ options = args.extract_options!
15
+ options[:builder] ||= self.class
16
+ fields_for(record_or_name_or_array, *(args << options), &block)
17
+ end
18
+
19
+ end
9
20
 
21
+ module FormulaFormHelper
22
+ @@builder = ::Formula::FormulaFormBuilder
23
+
24
+ def formula_form_for(record_or_name_or_array, *args, &proc)
25
+ options = args.extract_options!
26
+ options[:builder] ||= @@builder
27
+ form_for(record_or_name_or_array, *(args << options), &proc)
28
+ end
29
+
30
+ def formula_fields_for(record_or_name_or_array, *args, &block)
31
+ options = args.extract_options!
32
+ options[:builder] ||= @@builder
33
+ fields_for(record_or_name_or_array, *(args << options), &block)
34
+ end
35
+
10
36
  end
11
37
 
12
38
  end
@@ -4,6 +4,7 @@ require 'rails'
4
4
  module Formula
5
5
  class Railtie < Rails::Railtie
6
6
  initializer 'formula.initialize' do
7
+ ActionView::Base.send :include, Formula::FormulaFormHelper
7
8
  end
8
9
  end
9
10
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Sylvestre