Comments (4)
I manually added the help to the controller and then the issue is gone.
from activeadmin-axlsx.
I have a looking similar issue here.
After defining gem 'activeadmin-axlsx'
in Gemfile
, my Rails application's controllers can't use custom helpers which previously worked well. I tried helper :all
in ApplicationController that all other controllers inherit, it didn't work and I had to specify helpers I needed one by one.
I don't know much about how helpers are included, but it looks that activeadmin-axlsx gem affects the mechanism.
Maybe re-open this issue?
from activeadmin-axlsx.
I have also met this problem, and I tried to solve it, but unfortunately I failed.
So here's what I have done:
First, I cloned this gem into my local filesystem, and used my local version of this gem in my Gemfile. Since I don't really understand what's happening here, I started to comment out lines, in order to locate the problematic line of code.
So, I've found it is this line that causes the problem:
Once I commented this line out, my helpers are automatically loaded (Though this gem did not work, I suppose).
Since it mixes a module into ActiveAdmin::ResourceController, I dug into this line, which lead me to resource_controller_extension.rb, and I commented these lines out, which made ActiveAdmin::Axlsx::ResourceControllerExtension
an empty module. But my helpers are still not loaded!
In order to make sure that nothing in somewhere else magically adds stuff into the module, I changed the file into this:
# require 'active_admin'
# require 'active_admin/axlsx/version'
# require 'active_admin/axlsx/builder'
# require 'active_admin/axlsx/dsl'
# require 'active_admin/axlsx/resource_extension'
require 'active_admin/axlsx/resource_controller_extension'
class Railtie < ::Rails::Railtie
config.before_initialize do
# begin
# if Mime::Type.lookup_by_extension(:xlsx).nil?
# # The mime type to be used in respond_to |format| style web-services in rails
# Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
# end
# rescue NameError
# # noop
# end
# ActiveAdmin::ResourceDSL.send :include, ActiveAdmin::Axlsx::DSL
# ActiveAdmin::Resource.send :include, ActiveAdmin::Axlsx::ResourceExtension
# Problematic Line
# ActiveAdmin::ResourceController.send :include, ActiveAdmin::Axlsx::ResourceControllerExtension
module Foobar
end
ActiveAdmin::ResourceController.send :include, Foobar
# ActiveAdmin::Views::PaginatedCollection.add_format :xlsx
end
end
and it will still prevent my helpers from auto-loading! Once I comment ActiveAdmin::ResourceController.send :include, Foobar
out, my helpers would just be back, magically.
I tried to mix an empty module in in an initializer in my Rails application, it won't affect anything.
The rest of this problem is beyond my knowledge, does anyone have any ideas?
from activeadmin-axlsx.
Fixed it in this pull-request.
from activeadmin-axlsx.
Related Issues (20)
- Trailing zeros in column values HOT 1
- Custom helpers not being included, compass watch produces an error. HOT 1
- Active Admin scoped_collection HOT 2
- get data for pivot table from another sheet in after_filter hook HOT 1
- Not working with AA 1.0.0.pre HOT 3
- Breaking Routes
- Gemfile incompatible with activeadmin master/pre branch HOT 1
- `require': cannot load such file -- activeadmin/axlsx (LoadError) HOT 1
- wrong number of arguments (1 for 0) HOT 14
- "wrong number of arguments (1 for 0)", activeadmin (1.0.0.pre) ruby 2.1.2 and rails 4.1.5 HOT 2
- undefined local variable or method `max_csv_records' in AA 1.0.0.pre HOT 3
- The way to make activeadmin-axlsx work with newest ActiveAdmin 1.0 Rails4 (Tested) HOT 1
- Using only filtered elements in the excel download
- Using activeadmin-axlsx with ActiveAdmin version 1.0.0.pre1 causes a crash HOT 4
- two issues with devise
- index_without_xlsx(options) fails with wrong number of arguments (1 for 0) HOT 1
- 2.0.1 seems to break font-awesome-rails
- Excel cant open this file format error
- dependency was wrong
- Installation dependency axlsx is not recognized
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activeadmin-axlsx.