I am trying to use the simple-captcha gem with
gem "galetahub-simple_captcha", :require => "simple_captcha".
I am running Rails 5.0.0.1 and Ruby 2.3.2.
I couldn't get it to work in my app so I created a clean skin, rails new, rails generate scaffold User, rake db:migrate etc. As soon as I add the gem, I can bundle install fine, but as soon as I run rails test or rails generate or anything I get this error:
user/.rvm/gems/ruby-2.3.3/gems/galetahub-simple_captcha-0.1.5/lib/simple_captcha/form_builder.rb:7:in `included': uninitialized constant Sprockets::Helpers (NameError)
I have tried following the setup instructions for the gem, which says to run rails generate captcha after installing the gem, but as soon as I have installed the gem I get the error.
Any help would be appreciated.
On the other hand if anyone thinks there is a better captcha I should be using for form submission, let me know.
Looks like latest commit to "simple_captcha" repository was 3 years ago. It's outdated and maybe it will be not worked with Rails 5.
You can use Recaptcha from Google https://github.com/ambethia/recaptcha
You can use Recaptcha gem as advised by Alex
There is nice tutorial for this https://www.sitepoint.com/quick-tip-add-recaptcha-to-your-rails-application/
What happens after the simple captcha is installed?
Related
I was trying to install the Ruby Gem Devise and I stupidly overlooked a step. I included the gem in my gemfile then ran the bundle install on the prompt. Then I forgot to run the generator rails generate devise:install.
Then when I went to generate my User model it came up with the following error C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-5.1.4/lib/active_support/inflector/methods.rb:269:inconst_get': uninitialized constant User (NameError)`
I've tried uninstalling the gem and removing anything that refers to Users and reinstalling the gem but it keeps coming up with the same error.
I'm hoping someone can maybe shine a bit of light on this issue
I've just fixed the issue. When you run the bundle install command, it automatically configures the routes folder, so I've removed any reference to devise and it's worked now
I am building a new RoR app and i had tried to create a new model like below.
rails generate model Pic title:string description:text
But I keep on getting these errors always and I tried installing many methods like installing gems ,updated the gems etc.
P.S : I am trying install the older version of the gems. Is that creating a problem?
But none of it gave me the results. Please help me with this.
P.P.S : I am an absolute beginner to ruby. So please help me by giving solution with good reason. Thanks in Advance.
Hi seems like you have issues with your simple_form gem,try to remove from gem file and add gem 'simple_form' and run bundle install after this step run rails generate simple_form:install for creating config file for simple form.
Try this it may help you out.
As #Navneet pointed out generating a config file can also be used for configuration and it also works pretty well.
Another thing i found was , Here the gems used were older version. That created a compatibility issue(since it was not configured accordingly). So by replacing the gems with current version or stable ones , you can get rid of this problem.
Go to rubygems.org
Search for the gems and check whether its the latest version
If not, Replace the line of corresponding gem in Gemfile with newest one.
I'm relatively new to Ruby, and Rails, I need to use Rails version 3.2.19, for some tutorials I'm following along, I get all kinds of errors trying to follow along with Rails 4...anyways, when I do: gem install rails --version=3.2.19, it shows that it installed it. When I do rails -v, it shows Rails 4.1.5....I thought maybe if I create a new Rails app, specifying version 3.2.19, that would work. Surprise, it showed up as Rails 4.1.5 in my Gemfile...what gives? I tried manually changing it in the Gemfile and running bundle install, but then everything breaks when I fire up the Rails server...I searched those errors on here, and no surprise, all the answers were about how those are errors when trying to use Rails 3, in an app that was generated with Rails 4.
I'm really stumped about this folks and would appreciate any help! Thanks in advance!
1)please install rvm if YES,check the rvm ls
and set ruby 1.9.3 as default.and then make new project
2)can you see the which version of ruby using if 2+ then it will be rails 4
if you want to use rails 3 then use 1.9.3 ...
Are you doing rails _3.2.19_ new myapp
when you're generating your app?
Also when you change rails version on your Gemfile, you have to run bundle update rails to update the version.
i have installed nifty_generators successfully. Though, when i run the following command:
rails generate nifty_authentication
i get the error:
Could not find generator nifty_authentication.
I have included gem 'nifty_generators' in my gem file. What is the error?
Couple of things after looking on its github.
First, I believe the gem is call nifty-generators not nifty_generators, which may be causing you some other problems as well.
Second, per the instructions , you should be calling it via rails g nifty:authentication.
I installed rails on Windows7 using RailsInstaller (v2.1.0). I found the original rails was v3.2.1. After that, I "gem install spree". It seems the installation upgrades rails to v3.2.7. I mentioned that because before yesterday it was just 3.2.6. Every thing goes well under rails 3.2.6, but if I "spree install" a rails 3.2.7 app, I failed to access the default store's Cart. And get the error like this:
NoMethodError in Spree::OrdersController#edit
undefined method `password_salt=' for #<Spree::User:0x68438d0>
As I checking the database, yes, there is no "password_salt" but only "salt" in spree_users table.
Is there anyone else encountered this problem? I had taken almost half day on this problem. Did I miss something in the Spree path?
Thanks very much.
I think I had the exact same issue before, see if specifying spree gem version (assuming is 1.1.2) in the Gemfile and then running bundle update works
#Gemfile
gem 'spree', '1.1.2'
and later run
bundle update
See if it works!