Doodlebobbers

A tech blog.

Menu Close

Page 2 of 2

Truncate MySQL

(This is a legacy post from the old website.)

Blows out schema but leaves db with permissions etc. intact.

mysqldump -u<USER> -p<PASS> --add-drop-table --no-data <DATABASE> | grep ^DROP | mysql -u<USER> -p<PASS> <DATABASE>

Total commits in git

(This is a legacy post from the old website.)

I recently needed to know how many commits had gone toward a project. Short answer?

git rev-list --all | wc-l

This will give you total commits for all branches on the remote repo.

I stole this from Ruslan Khmelyuk’s blog. Additionally, there is a Stackoverflow thread about it.

Association named ‘spree_roles’ was not found; perhaps you misspelled it?

(This is a legacy post from the old website.)

Association named ‘spree_roles’ was not found; perhaps you misspelled it?

I ran into this error while developing an extension for Spree 1-3-stable
and writing request specs to run on the dummy test app generated via bundle exec rake test_app.
You may have also run into this error on a normal Spree app if you
installed Spree in your Rails apps using just your Gemfile and bundler
instead of spree install <my_store>.

Regardless, this is an issue with Spree not setting the correct user
model in the spree initializer during install. To correct this, update config/intializers/spree.rb to use:

Spree.user_class = "Spree::User"

instead of

Spree.user_class = "Spree::LegacyUser"

If you’re having this issue with the dummy test app spec/dummy, just do the same for the dummy app’s initializer: spec/dummy/config/initializers/spree.rb

For more information:
See the issue for dummy test_app:https://github.com/spree/spree/issues/1966
See the issue for regular Spree:https://github.com/radar/spree_auth_devise/issues/1

© 2019 Doodlebobbers. All rights reserved.

Theme by Anders Norén.