I am using mailboxer in my Rails 4 app.
gem 'mailboxer'
I recently updated it from 0.11 to 0.12.4, it stopped working, and I cant figure out why. Now, I am getting the error:
uninitialized constant Message
I checked the gem's GitHub repo and it does have the Message model.
I checked my local version of the gem and it matches up.
Puma:mailboxer Jeff$ pwd
/Users/Jeff/.rvm/gems/ruby-2.0.0-p247/gems/mailboxer-0.12.4/app/models/mailboxer
Puma:mailboxer Jeff$ ls
conversation conversation.rb mailbox.rb message.rb notification.rb receipt.rb
Why isn't my app finding the model? How do I fix this?
Message is now namespaced as Mailboxer::Message. According to the upgrade documentation, you also need to run through a few steps when upgrading from 0.11 to 0.12:
rails generate mailboxer:namespacing_compatibility
rails generate mailboxer:install -s
rake db:migrate
Related
I have work on project with ruby on rails and i want to use friendly_id gem. When I install friendly_id gem in my project then add following code according to instructions.
controller:
def show
#group = Group.friendly.find(params[:id])
end
Model:
extend FriendlyId
friendly_id :title, use: [:slugged]
I am using rails version 3.2.11 and friendly_id gem is 4.0.0
Getting error in controller. i do not understand why its happening.
error:
undefined method `slug' for #<Group:0x000000092ac228>
Update:
Previous issue solve with restart server and migrating database.
but it generates new issue Couldn't find group with id=new-demo-group
It seems like you need to update the records that are already created, in your case that would be (Group model), as docs says:
If you're adding FriendlyId to an existing app and need to generate
slugs for existing users, do this from the console, runner, or add a
Rake task:
Group.find_each(&:save)
Rails console
Open terminal on the app root and run (-e is the environment)
rails console -e production
You should get a similar output to this (I added the command to run):
Running via Spring preloader in process 5389
Loading production environment (Rails 5.1.5)
2.5.1 :001 > Group.find_each(&:save)
Rails runner
Open terminal on the app root and run (-e is the environment)
rails runner -e production "Group.find_each(&:save)"
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?
I installed devise 1.1.rc0 and haven't been able to get it to work in my existing application.
I changed the gem file to gem 'devise' without specifying the version. Ran bundle install. Then ran rail destroy devise_install since that's the command I used to install it.
*Then when I tried to reintall with rails generate devise:install it gives me this error:
gems/activerecord-3.2.8/lib/active_record/dynamic_matchers.rb:50:in method_missing': undefined methoddevise' for # (NoMethodError)*
Ryan Bigg helped me figure out the above error was caused by the user model making a reference to devise, which after the uninstall causes an error. So I removed that reference.
Now I have this error.
gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant User (NameError)
What is this referring to?
You're getting this error because Devise isn't configured, yet your model references it. Remove the call to the devise method (or comment it out) in any model that references it.
I found the same issue when upgrading from 1.8.7 and Rails 3.0.7 to 1.9.3 and Rails 3.2.8. The solution involves removing:
gem 'active_reload'
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!
Im creating a simple Rails 2.3.8 gem and need a migration file inside it. I following this structure:
/
/generators
/generators/conductor_migration
/generators/conductor_migration/conductor_migration_generator.rb
/generators/conductor_migration/templates
/generators/conductor_migration/templates/conductor_migration.rb
but when I install the gem in my app and run script/generate conductor_migration i says it cant find the migration.
Any thoughts?
Turns out it's a bug in bundler for 2.3.8. I received a note from them yesterday saying that you can't access generators in gems that are local with bundler in 2.3.X you need to install them from the server. Lovely.