-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rake db:migrate fails if tables is not exist #8
Comments
This is fixes in master (f57f64f), perhaps a new RubyGems release would be in order… |
New gem release would be nice @randym 👍 |
Is it fixed in the 1.0.6 gem version ? I've the same problem with only active admin classes. |
I confirm that this bug remains in the 1.0.6 version. I fixed it changing my gemfile in the following way: gem 'acts_as_xlsx', '= 1.0.6' +1 to a new gem release @randym |
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:in
columns'/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:in
yield'/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:in
columns'/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:in
acts_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:in
block 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:in
load_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:in
load_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:in
const_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:in
each'/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:in
constantize'/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:in
constantize'/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:in
to'/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:in
routes'/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:in
initialize'/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:in
add_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:in
each'/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:in
block 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:in
eval_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:in
block 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:in
load'/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:in
each'/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:in
reload!'/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:in
block 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:in
run_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:in
prepare!'/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:in
instance_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:in
block 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:in
initialize!'/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:in
block 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:in
require'/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:in
block 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"
The text was updated successfully, but these errors were encountered: