Ember-appkit-rails sprockets NoMethodError - ruby-on-rails

I've installed ember-appkit-rails, but when I do rails g ember:bootstrap I get the following error can anyone help?
/home/ltsimps/.rvm/ruby-1.9.3-p392/gems/ember-appkit-rails-0.3.0/lib/ember/appkit/rails/sprockets/context.rb:10:in '': undefined method prepend' for Sprockets::Context:Class (NoMethodError)
from /home/ltsimps/.rvm/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in 'require'
from /home/ltsimps/.rvm/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228 'block in require'
from /home/ltsimps/.rvm/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213 'load_dependency'
from /home/ltsimps/.rvm/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228 'require'
from /home/ltsimps/.rvm/ruby-1.9.3-p392/gems/ember-appkit-rails-0.3.0/lib/ember/appkit/rails/sprockets.rb:3:in ....

I just changed to ruby 2.0 and that fixed the problem.

Related

when running $ rails test, get the result as below

when running $ rails test, I get the error as below, how to solve this problem?
/home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/testing/declarative.rb:14:in 'test': test_should_get_help is already defined in StaticPagesControllerTest (RuntimeError)
from /home/nafihnafi/workspace/sample_app/test/controllers/static_pages_controller_test.rb:10:in '<class:StaticPagesControllerTest>'
from /home/nafihnafi/workspace/sample_app/test/controllers/static_pages_controller_test.rb:3:in '<top (required)>'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in 'require'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in 'block in require'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in 'load_dependency'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in 'require'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:14:in 'block in require_files'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in 'each'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in 'require_files'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:94:in 'plugin_rails_init'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:81:in 'block in init_plugins'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in 'each'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in 'init_plugins'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:130:in 'run'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:77:in 'run'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:63:in 'block in autorun'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from /home/nafihnafi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from -e:1:in '<main>'
You're defining test_should_get_help somewhere again, when it's already been defined. Make sure it's only defined once - put the function in a private block at the end of the file like this:
[file end]
private
def test_should_get_help
[blah]
end
If you need it in multiple files, try adding it as a helper.

Paperclip Gem - undefined method '_image_post_process_callbacks'

I have an application on Heroku that uses the Paperclip gem that recently had some issues - and I'm not 100% sure on what it was that caused it. I have the application working locally (including the image upload) - but I get an 'Application Error' page on the heroku url, and when I try to access the heroku console with heroku run rails c it gets an error of:
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in 'method_missing': undefined method '_image_post_process_callbacks' for #<Class:0x007f8aaf5d2fa0> (NoMethodError)
A little background on the issue - another developer was working on creating an image upload model - which was named 'Images' - which I think caused problems with Paperclip, and wouldn't allow me to run a Rails migration. When I tried it said there was an issue with the 'Images' table, so after finding a similar situation online, I commented out the body of the 'def change' within the create_images migration - which now looks like so:
class CreateImages < ActiveRecord::Migration
def change
# create_table :images do |t|
# t.attachment :file
# end
end
end
I then ran another migration - started my server locally and everything was working. I then pushed my changes to heroku, did a rake db:migrate for good luck - and the heroku url is still showing 'Application Error'
If anyone has any idea of possible causes of these issues, it would be greatly appreciated! Thanks for reading!
EDIT
After running heroku run rails c I get this output.
Running rails c on independentskiermag... up, run.7049
Routing about
Routing terms-of-service
Routing privacy-policy
Routing contact
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in 'method_missing': undefined method '_image_post_process_callbacks' for #<Class:0x007f9ff5864330> (NoMethodError)
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:785:in 'get_callbacks'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:647:in 'set_callback'
from (eval):2:in 'before_image_post_process'
from /app/vendor/bundle/ruby/2.0.0/gems/paperclip-4.3.2/lib/paperclip/validators.rb:67:in 'create_validating_before_filter'
from /app/vendor/bundle/ruby/2.0.0/gems/paperclip-4.3.2/lib/paperclip/validators.rb:60:in 'block in validate_before_processing'
from /app/vendor/bundle/ruby/2.0.0/gems/paperclip-4.3.2/lib/paperclip/validators.rb:58:in 'each'
from /app/vendor/bundle/ruby/2.0.0/gems/paperclip-4.3.2/lib/paperclip/validators.rb:58:in 'validate_before_processing'
from /app/vendor/bundle/ruby/2.0.0/gems/paperclip-4.3.2/lib/paperclip/validators/attachment_content_type_validator.rb:84:in 'validates_attachment_content_type'
from /app/app/models/image.rb:4:in '<class:Image>'
from /app/app/models/image.rb:1:in '<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in 'load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:360:in 'require_or_load'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:317:in 'depend_on'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:233:in 'require_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:472:in 'block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:471:in 'each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:471:in 'block in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:469:in 'each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:469:in 'eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:346:in 'eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:56:in 'each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:56:in 'block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in 'instance_exec'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in 'run'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in 'block in run_initializers'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in 'block in tsort_each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in 'block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in 'each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in 'block in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in 'each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in 'each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in 'tsort_each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in 'run_initializers'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:352:in 'initialize!'
from /app/config/environment.rb:5:in '<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in 'load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in 'require'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:328:in 'require_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:142:in 'require_application_and_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:67:in 'console'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in 'run_command!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in '<top (required)>'
from /app/bin/rails:8:in 'require'
from /app/bin/rails:8:in '<main>'
First off, if you need to undo a migration on Heroku, you will need to un-comment out the body of your migration, push to Heroku, then run heroku run rake db:rollback in order to undo it and get your application working again in the interim.
If you are still having trouble, post the errors and any relevant code in your post.

Getters/settings not working when using the rails-setting gem - method missing error

I'm using the rails-settings gem: https://github.com/huacnlee/rails-settings-cached
The getter/setter method are not working.
I've added the following line to my user model as directed:
include RailsSettings::Extend
I've also tried adding it to role.rb (as I am using rolify gem)
However is am still getting the following error message:
NoMethodError: undefined method `settings' for #<User:0x007f8dd017a560>
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in `method_missing'
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:in `method_missing'
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/rolify-3.2.0/lib/rolify/role.rb:73:in `method_missing'
from (irb):24
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from /Users/jamieturner/.rvm/gems/ruby-2.0.0-p353#accufly/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When I run:
user = User.find(2)
user.settings.color = :red
Can anyone see what the issue is?
Ok, I've solved the issue.
I had not restarted the console session.....restarting it got it working!

Error instantiating mechanize object

I have no idea what the problem is on this. I'm trying this in the rails console:
>> agent = Mechanize.new
NoMethodError: undefined method `user' for nil:NilClass
I added gem 'mechanize' and did a bundle install. I did require 'mechanize'. I also tried require 'nokogiri' below that, and every time I get the same error. I've tried 4 or 5 different ways to instantiate a new mechanize object and haven't been able to find one.
I searched my entire rails app for the string '.user' and couldn't find any. Not sure what the deal is here. Any ideas?
Thanks
EDIT
Full Stack trace
NoMethodError: undefined method `user' for nil:NilClass
from /home/me/.rvm/gems/ruby-1.9.3-p448#my_app/gems/net-http-persistent-2.9.2/lib/net/http/persistent.rb:866:in `proxy='
from /home/me/.rvm/gems/ruby-1.9.3-p448#my_app/gems/mechanize-2.7.2/lib/mechanize/http/agent.rb:1189:in `set_proxy'
from /home/me/.rvm/gems/ruby-1.9.3-p448#my_app/gems/mechanize-2.7.2/lib/mechanize.rb:204:in `initialize'
from (irb):5:in `new'
from (irb):5
from /home/me/.rvm/gems/ruby-1.9.3-p448#global/gems/railties-3.2.15/lib/rails/commands/console.rb:47:in `start'
from /home/me/.rvm/gems/ruby-1.9.3-p448#global/gems/railties-3.2.15/lib/rails/commands/console.rb:8:in `start'
from /home/me/.rvm/gems/ruby-1.9.3-p448#global/gems/railties-3.2.15/lib/rails/commands.rb:41:in `<top (required)>'
from /home/me/Dropbox/Work/RubymineProjects/apps/my_app/script/rails:6:in `require'
from /home/me/Dropbox/Work/RubymineProjects/apps/my_app/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
You're not doing anything wrong: the version of mechanize that came out a few days ago is buggy. I solved that error just updating the gem (i.e., with bundle update mechanize).

issue installing active admin - rails 3.0.3 - uninitialized constant Formtastic::SemanticFormHelper

I'm trying to add activeadmin to my rails 3.0.3 app.
I'm following the instructions here
When I run - rake db:migrate I get the following error -
rake aborted!
uninitialized constant Formtastic::SemanticFormHelper
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `eval'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/resource_controller.rb:1:in `<top (required)>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:3:in `<module:Dashboards>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:2:in `<module:ActiveAdmin>'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/dashboards/dashboard_controller.rb:1:in `<top (required)>'
(eval):1:in `generate_dashboard_controller'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `eval'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:167:in `generate_dashboard_controller'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin/namespace.rb:38:in `initialize'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:147:in `new'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:147:in `find_or_create_namespace'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:282:in `load_default_namespace'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:188:in `load!'
/Users/me/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.2.2/lib/active_admin.rb:212:in `routes'
You seem to be missing the formtastic gem. In the current version of active-admin (0.3.2) it is correctly specified as a dependency.
So I hope updating the activeadmin gem (bundle update activeadmin) will fix it.
If that does not fix it, I would add formtastic explicitly to the Gemfile.
Hope this helps.
In rails 3 the Formtastic::SemanticFormHelper became => Formtastic::Helpers::FormHelper
Don't forget to load your lib. By default rails don't load them so you can just uncomment config.autoload_paths += %W(#{config.root}/lib) in your application.rb

Resources