I have included the simple_captcha gem as instructed on their site:
gem 'simple_captcha', :git => 'git://github.com/galetahub/simple-captcha.git'
I have then run bundler to install it.
Finally when I go to run the following command I get an error:
rails generate simple_captcha
.rvm/gems/ruby-1.9.3-p327#eapi4/bundler/gems/simple-captcha-e99cc7e8bf6b/lib/simple_captcha/form_builder.rb:7:in `included': uninitialized constant Sprockets::Helpers (NameError)
I've searched on the web and can't find any other users with this problem.
Any help appreciated
They say in this pull request that the plugin doesn't support rails 4, You can download their branch and try it out.
Looking at the diff it shows your problem
- base.send(:include, Sprockets::Helpers::RailsHelper)
- base.send(:include, Sprockets::Helpers::IsolatedHelper)
+ base.send(:include, Sprockets::Rails::Helper)
https://github.com/galetahub/simple-captcha/pull/39/files
you could this as the previous version of simple_captcha is not supported on rails 3.
Azdaroth forked of simple_captcha
gem 'simple_captcha', :git => 'git://github.com/Azdaroth/simple-captcha.git', :branch => 'rails-4'
Related
Hey there and Merry Xmas,
I would like to add the DDMathParser to my Swift 3 project using the latest CocoaPods version. The problem is I only get DDMathParser 2.0.0 installed. What do I miss?
my podfile is:
platform :osx, '10.11'
target 'DDTest02' do
use_frameworks!
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git'
When I try using:
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git', :branch => 'swift-3.0'
It throws an error warning: Could not find remote branch swift-3.0 to clone.
fatal: Remote branch swift-3.0 not found in upstream origin
DDMathParser author here...
There is no swift-3.0 branch, so I'm not sure why you're trying that. Try specifying the 3.0.0 tag using:
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git', :tag ⇒ '3.0.0'
I am using:
gem 'ajaxful_rating', :git => "git://github.com/helloenvoy/ajaxful-rating", :branch => "rails4".
When I try to call method rating_for, throwing an error:
uninitialized constant ActionController::RecordIdentifier
What verison of Rails are you using? The ActionController::RecordIdentifier was (re)moved to ActionView in Rails 4.1 and should be now used as a ActionView::RecordIdentifier.
http://edgeapi.rubyonrails.org/classes/ActionController/RecordIdentifier.html
So if you are using more recent version, you should change this line in the gem https://github.com/edgarjs/ajaxful-rating/blob/b223cba94702aa0229d084f8de976c0284ac4f36/lib/axr/stars_builder.rb#L48.
I have an application that runs fine under Rails 2.3.2.
I'm trying to upgrade it to Rails 4.0, using nginx and unicorn.
My config/environment.rb has these lines that don't work:
Rails::Initializer.run do |config|
config.load_paths += %W( #{RAILS_ROOT}/vendor/gems/ #{RAILS_ROOT}/app/exceptions/ )
config.action_controller.session = { :session_key => "my_app", :secret => "c4c6eee57d9af4f2e1a9c56a49d974b7" }
config.gem "mocha", :version => '>=0.9.4'
The error message I get in unicorn.log is
ERROR -- : uninitialized constant Rails (NameError)
/home/art/config/environment.rb:70:in `<top (required)>'
and line 70 is the " Rails::Initializer.run do |config|" line above.
I guess these things have been moved out into some initializer file somewhere?
I guess bundler now handle gem versions, so I should just move the "config.gem... :version ..." lines into my Gemfile?
And where should I set session_key?
Thanks for any advice.
in the new Rails require the application.rb file:
# Load the Rails application.
require File.expand_path('../application', __FILE__)
In the application.rb require rails:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
usually the session_key is in a new initializer (under initializers folder - look here)
anyway try to run rake rails:update it might help you change some stuff,
or create new rails project and start to copy things from there.
I'm using Rails 4 + prawn_rails + the latest version of prawn (v 1.1.0) and I noticed in the changelog here: https://github.com/prawnpdf/prawn/wiki/CHANGELOG that tables are now separated.
I followed the instructions to require "prawn/tables". I did this by adding a file in my lib directory:
lib/prawn.rb
require "prawn/tables"
I restarted my rails server and I still get the error:
NoMethodError - undefined method `table' for #<Prawn::Document:0x007fda2d594a98>:
How do I fix this?
You should add these lines into your Gemfile.
gem 'prawn', '~> 1.2.1'
gem 'prawn-table', '~> 0.1.0'
The line in the documentation is WRONG. add require 'prawn/table'
to your .pdf.prawn file on the top and it will work.
I have a Puppet manifest that installs the Zurb Foundation gem:
class compass {
package { ["rubygems"]:
ensure => 'installed'
}
package { ['zurb-foundation']:
ensure => '3.0.6',
provider => 'gem',
require => Package['rubygems']
}
}
This causes the following error when running puppet apply:
err: /Stage[main]/Compass/Package[zurb-foundation]/ensure: change from absent to 3.0.6 failed: Could not update: Execution of '/usr/bin/gem install -v 3.0.6 --include-dependencies --no-rdoc --no-ri zurb-foundation' returned 1: INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Building native extensions. This could take a while...
ERROR: Error installing zurb-foundation:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
at /etc/puppet/manifests/classes/compass.pp:25
However, doing a gem list yields the following results:
# gem list
*** LOCAL GEMS ***
chunky_png (1.2.8)
compass (0.12.2)
fssm (0.2.10)
rake (10.1.0)
rb-fsevent (0.9.3)
sass (3.2.0.alpha.277)
zurb-foundation (3.0.6)
The error causes puppet apply to not complete properly, since a lot of items are skipped because of failed dependencies. What can I do?
I think that the problem is that you don't have the ruby dev kit installed for you ruby (that's what's used to build native extensions).
You'll want to add something like (it may be different depending on your version of ruby):
package { 'ruby-dev':
ensure => installed,
before => Package['zurb-foundation'],
}
This should allow the gem to be built properly and let your puppet run finish too.