Questions tagged [gon]
25 questions
12
votes
1 answer
Ruby on Rails Gon Gem vs. cookies or regular AJAX request
I've been programming on Ruby on Rails for a while now, and to be able to easily access data from my controllers in my javascript code, as a beginner I came across the Gon Gem. It solves the problem quite simply, but a bit mysteriously to the RoR…

jvrsgsty
- 588
- 4
- 18
4
votes
1 answer
undefined local variable or method `gon' for ApplicationController:Class in rails 4.2
I can't seem to get the gon gem working with rails 4.2.0. I am getting "undefined local variable or method `gon' for #" Am I using it correctly? Also I do have the <%= include_gon(:init => true) %> in the header of my layout…

Sathibabu P
- 649
- 1
- 7
- 15
4
votes
2 answers
Testing methods using gon with rspec
I have a function that sends a variable to js with the help of gon.
def calc_foo
# calculate foo
gon.foo = foo
end
I want to test this function i.e make sure that the method return the correct value, using rspec.
it "should return bar" do
foo…

tugger
- 41
- 2
3
votes
1 answer
How can I use a Rails helper inside Jbuilder with the Gon gem?
I'm using Jbuilder and Gon to structure my JSON responses into variables and pass them to my JS front-end. In the Jbuilder files, I'd like to access the helper methods I'm using from the Money-Rails gem. However, if I try something like this...
//…

Travis Smith
- 622
- 5
- 22
3
votes
1 answer
undefined local variable or method `env' for method in controller
I'm currently using 'gon' to pass my client id for payment to the javascript sdk of the payment gateway (Braintree in my case).
When I try to set the client id generated to a 'gon' variable, I'm facing this error.
Basically this is my code
def new
…

Anirudh Madhavan
- 63
- 6
3
votes
2 answers
GON - not getting value in js.erb + Rails 5
Gem File
gem 'gon'
This is my application.html.erb File.
Test Title
<%= Gon::Base.render_data %>
<%= include_gon(:init => true) %>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application',…

RoR Developer
- 151
- 1
- 13
3
votes
1 answer
test-unit automatic runner produce "invalid option" error on rake tasks?
Since I've installed gon, my rake tasks aren't working anymore.
I'm using:
Rails 3.2.22.2
ruby 2.2.0p0
gon-6.0.1
test-unit-3.0.8
I can't uninstall test-unit because:
$ rails…

fro_oo
- 1,610
- 4
- 24
- 46
2
votes
0 answers
Rails 5 gem gon not recognize jbuilder file
I have implemented rails gem gon in index method and it works fine. But when I try to implement in controller#new it is not working this is my error output:
No such file or directory @ rb_sysopen - app/views/cuenta_proveedors/new.json.jbuilder
but…

matQ
- 597
- 2
- 13
- 27
2
votes
2 answers
How to define gon variables in the rails view (slim files)?
I have a number of views where I need to pass ruby/rails arrays to javascript/jquery code in my project. I'm using the gon gem which works fine when I define the gon variables in the controller code, but how can I assign the variable in the view…

midhunsezhi
- 461
- 5
- 10
1
vote
1 answer
goreleaser signing using gon - bundle format unrecognized, invalid, or unsuitable
I am trying to sign my golang using goreleaser - and eventually distribute using Homebrew. But this will require signing with Apple Developer ID to be able to distribute to MacOs.
Have you seen the following error using gon and fixed it?
yaml sample…

Chris G.
- 23,930
- 48
- 177
- 302
1
vote
0 answers
Why does sort_by change my array elements?
I would expect that application of sort_by would change the order, but nothing else, about an array.
Here's my original line:
gon.frames = @job.sequence.frames.sort_by(&:n)
And a modified line, where sort_by is removed:
gon.frames =…

afarley
- 781
- 6
- 26
1
vote
1 answer
Update my view depending on the status of my api call on a rails/react app
I have a rails app set up with react as front end. From my rails controller I am making a call to a browser based api. Through Watir and some "puts" inside my controller I can get the status of my call inside the terminal. For example in my terminal…

maxvia
- 21
- 1
- 2
1
vote
1 answer
Use Gon in rails model
Before upgrading to rails 5 I had include Gon::GonHelpers in my model file. Now I get an error and I am not able to use the gon variable in my model.
I get the error message:
NameError: undefined local variable or method `gon' for ....
How can I…

marimaf
- 5,382
- 3
- 50
- 68
1
vote
1 answer
Python math module grad
I am trying to use the basic sin, cos, arctan, etc function from numpy, but I want to use gradians. I have search the doc without success, and search for other python modules without luck. Any suggestion on a python module i could use?
Or a function…

oste-popp
- 190
- 1
- 10
0
votes
0 answers
Rails - how to expose attr_accessor when collecting all attributes
I am using the gon gem to get access to model objects in the front end. So in my controller I have something like this:
gon.items = @items
This isn't really a gon issue, basically gon.items is just an array of all @items where each array object n…

james
- 3,989
- 8
- 47
- 102