Permalink
Browse files

Bump version after pull request commits

  • Loading branch information...
1 parent 8516472 commit 22e12101a982659c94ffcbb7258f1c45cf4ff49a @gazay committed Feb 15, 2012
Showing with 12 additions and 1 deletion.
  1. +2 −0 README.md
  2. +4 −0 lib/gon.rb
  3. +2 −0 lib/gon/helpers.rb
  4. +1 −0 lib/gon/jbuilder.rb
  5. +2 −0 lib/gon/rabl.rb
  6. +1 −1 lib/gon/version.rb
View
@@ -11,6 +11,8 @@ For Sinatra available [gon-sinatra](https://github.com/gazay/gon-sinatra).
## An example of typical use
+### Very good and detailed example and reasons to use is considered in [railscast](http://railscasts.com/episodes/324-passing-data-to-javascript) by Ryan Bates
+
When you need to send some start data from your controller to your js
you might be doing something like this:
View
@@ -13,6 +13,7 @@
module Gon
class << self
+
def all_variables
@request_env[:gon]
end
@@ -63,10 +64,12 @@ def set_variable(name, value)
@request_env[:gon][name] = value
end
+ # TODO: Remove required argument view_path, and by default use current action
def rabl(view_path, options = {})
if !defined?(Gon::Rabl)
raise NoMethodError.new('You should define Rabl in your Gemfile')
end
+
rabl_data = Gon::Rabl.parse_rabl(view_path, options[:controller] ||
@request_env['action_controller.instance'] ||
@request_env['action_controller.rescue.response'].
@@ -106,4 +109,5 @@ def jbuilder(view_path, options = {})
end
end
end
+
end
View
@@ -1,5 +1,6 @@
module Gon
module Helpers
+
def self.included base
base.send(:include, InstanceMethods)
end
@@ -43,6 +44,7 @@ def gon
end
end
end
+
end
ActionView::Base.send :include, Gon::Helpers
View
@@ -41,6 +41,7 @@ def find_partials(lines = [])
end
end.flatten
end
+
end
end
end
View
@@ -3,12 +3,14 @@
module Gon
module Rabl
class << self
+
def parse_rabl(rabl_path, controller)
source = File.read(rabl_path)
rabl_engine = ::Rabl::Engine.new(source, :format => 'json')
output = rabl_engine.render(controller, {})
JSON.parse(output)
end
+
end
end
end
View
@@ -1,3 +1,3 @@
module Gon
- VERSION = '2.0.6'
+ VERSION = '2.1.0'
end

0 comments on commit 22e1210

Please sign in to comment.