Coder Social home page Coder Social logo

acts_as_xlsx's Introduction

Hi there ๐Ÿ‘‹

acts_as_xlsx's People

Contributors

randym avatar razenha avatar vesan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acts_as_xlsx's Issues

rake db:migrate fails if tables is not exist

rake db:migrate fails when there is no database created yet. For example:

class User:

class User < ActiveRecord::Base
...
acts_as_xlsx
end

and rake db:migrate shows this:

roman@roman-home:~/tgmu_rating$ rake db:migrate
rake aborted!
Could not find table 'users'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:509:in table_structure' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:396:incolumns'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:114:in block in prepare_default_proc' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:56:inyield'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:56:in columns' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/model_schema.rb:208:incolumns'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/model_schema.rb:247:in column_names' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/acts_as_xlsx-1.0.6/lib/acts_as_xlsx/ar.rb:31:inacts_as_xlsx'
/home/roman/tgmu_rating/app/models/user.rb:18:in <class:User>' /home/roman/tgmu_rating/app/models/user.rb:1:in<top (required)>'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in load' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:inblock in load_file'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in new_constants_in' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:inload_file'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:in require_or_load' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:inload_missing_constant'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:in const_missing' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:inconst_get'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in block in constantize' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:ineach'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in inject' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:inconstantize'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:534:in get' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:565:inconstantize'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise.rb:297:in get' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/mapping.rb:77:into'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/mapping.rb:72:in modules' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/mapping.rb:89:inroutes'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/mapping.rb:156:in default_used_route' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/mapping.rb:66:ininitialize'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise.rb:331:in new' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise.rb:331:inadd_mapping'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/rails/routes.rb:221:in block in devise_for' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/rails/routes.rb:220:ineach'
/home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/devise-d5e0171cb407/lib/devise/rails/routes.rb:220:in devise_for' /home/roman/tgmu_rating/config/routes.rb:12:inblock in <top (required)>'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in instance_exec' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:ineval_block'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in draw' /home/roman/tgmu_rating/config/routes.rb:1:in<top (required)>'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in load' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:inblock in load'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in load_dependency' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:inload'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in block in load_paths' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:ineach'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in load_paths' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:inreload!'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application.rb:102:in reload_routes!' /home/roman/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-f21cff30e721/lib/active_admin/application.rb:239:inblock in attach_reloader'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:387:in _run__571715648900980799__prepare__callbacks' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:inrun_callbacks'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.0/lib/action_dispatch/middleware/reloader.rb:74:in prepare!' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.0/lib/action_dispatch/middleware/reloader.rb:46:inprepare!'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application/finisher.rb:50:in block in <module:Finisher>' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/initializable.rb:54:in run_initializers' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application.rb:215:ininitialize!'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in method_missing' /home/roman/tgmu_rating/config/environment.rb:6:in<top (required)>'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in require' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inblock in require'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in load_dependency' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inrequire'
/home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application.rb:189:in require_environment!' /home/roman/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/application.rb:249:inblock in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

Was fixed with that:

class User < ActiveRecord::Base
...
acts_as_xlsx if ActiveRecord::Base.connection.table_exists? 'users'
end

But I think it is not "Rails way"

Missing template

I tried to create a .xlsx.axlsx template but I get this error message:

Missing template item_refs/index, application/index with {:locale=>[:fr], :formats=>[:xlsx], :handlers=>[:erb, :builder, :raw, :ruby, :slim, :jbuilder, :coffee]}

My controller is like so:

def index
@item_refs = ItemRef.filtered_by(params[:q]).order(sort_order).first(10)
respond_to do |format|
format.html
format.js
format.xlsx { render :xlsx => "index", filename: 'items.xlsx'
}
end
end

And this is my view (index.xlsx.axlsx):

ItemRef.to_xlsx package: xlsx_package

xlsx_package.workbook.worksheets.first.tap do |sheet|
sheet.add_row ["First Column", "Second", "Third"]
sheet.add_row [1, 2, 3]
sheet.add_row [' preserving whitespace']
end

Am I doing something wrong? Thanks.

.html.erb template being rendered in place of .xlsx.axlsx template.

tested in webrick and thin server in development env. The code works (or .xlsx.axlsx template rendered) in live server deployed in nginx and unicorn but same code renders .html.erb template in local machine in dev env. running webrick or thin. Really, can't figure out the problem.

Maintained?

I am looking into using this gem but noticed https://github.com/randym/axlsx was updated within the last month and this has not been updated in 2 years. Is this still the correct gem for a Rails 4 developer to use?

Chain Method column does not support nil values

Hi, I'm having problems when using the gem. My model has an association that accept nulls. This association has a name method, so for the ones that are not null I would like to display the name so I have:

acts_as_xlsx :columns => [ 'supplier.name' ]

Since there are entities that do not have supplier I get:

undefined method `name' for nil:NilClass

Any workarround for this?
Thanks
Enrique

Drop support for ActiveRecord 2?

Do you have plans to drop support for ActiveRecord 2.x? It's so old and not supported by the vendor.

I am asking because acts_as_xlsx is printing deprecation notices on Rails 4. I want to submit a pull request, but before I fix it by switching on ActiveRecord version, you might want to consider dropping support for 2.x.

Calling #find(:all) is deprecated. Please call #all directly instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.