Error after adding gem 'mithril_rails' - ruby-on-rails

I add gem 'mithril_rails' in my Gemfile, make bundle install and bundle update, add //= require mithril in my application.js file, type rails s and get error:
/Users/myusername/.rvm/gems/ruby-2.2.2/gems/mithril_rails-0.0.7/lib/mithril_rails/rails/engine.rb:5:in block in <class:Engine>': undefined methodregister_engine' for
nil:NilClass (NoMethodError)
I use rails 4.2.3, mongoid.
What can I do?

You can use 'sprockets 2.12.3'. The issue relating to sprockets and already reported.

Related

*= require font-awesome gives undefined method `dependency_paths' for #<Sprockets::StaticAsset:0x007fe40cf30208> error

I am using rails 3.1.12, and wanted to use font-awesome-sass gem. So i included it in my gemfile, and did bundle install. Everything worked fine.
then I put *= require font-awesome in application.css file, and started the server, but i get this error :
undefined method `dependency_paths' for "#< Sprockets::StaticAsset:0x007fe40cf30208>
I think, its something to do with *= require font-awesome.
Make sure to use font-awesome version 3.1.1.0 or earlier.
In your gemfile:
gem 'font-awesome-rails', '3.1.1.0'
And then bundle install/bundle update
Github Readme
And have you restarted the rails server?

undefined method rails 3.2.9 and devise 1.0.11

Error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/devise-1.0.11/lib/devise.rb:89:in '': undefined method 'weeks' for 2:Fixnum (NoMethodError)
That error is thrown whenever I try to run 'rails g devise:install' in a rails project I've been working on.
Any ideas?
P.S. requiring gem 'devise' in Gemfile and running bundle install to get the devise gem
This issue was already dealt with here. Try updating to a later devise version to fix.

Undefined method `mass_assignment_sanitizer=' for ActiveRecord::Base:Class (NoMethodError)

I'm learning Rails with the awesome Ruby on Rails Tutorial by Michael Hartl. I'm on section 3.2.2 (Test Driven Development) in which I need to run the following command to run the rspec tests for my Rails project:
bundle exec rspec spec/
But it doesn't work. Instead I get this error:
/Users/mh/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/
activerecord-3.1.3/lib/active_record/base.rb:1088:in `method_missing':
undefined method `mass_assignment_sanitizer=' for
ActiveRecord::Base:Class (NoMethodError)
I've tried reinstalling rspec and changing my Gemfile, but nothing appeases the undefined method error!
Did you downgrade from Rails 3.2 RC1? Comment out the following two lines from your development.rb:
config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5
While m818's answer will solve the problem, you might still get errors if you are tyring to use deprecated methods elsewhere in your code.
I had the same problem, commenting out those lines got rid of some errors, but not all of them, anywhere I was using attr_accessible gave me the same error.
It turned out to be the `active_record' gem that was updated to 4.0 when I didn't want it to. Since I'm using a Padrino app, I had to do this in the Gemfile:
gem 'activerecord', '= 3.2.12', :require => "active_record"
That solved all issues and I didn't have to comment out the lines in database.rb.

Uninitialized Constant in Rails 3.0.1 using the RedCloth 4.2.2 gem

I'm having an issue with using RedCloth in my local application. I keep getting the following error:
uninitialized constant ActionView::CompiledTemplates::RedCloth
This happens because I have the following code:
<%= RedCloth.new("Some text").to_html %>
What I tried to do is put this in the environment.rb file:
require "RedCloth"
However, when I do this, I get a huge error with my Phusion Passenger + Nginx configuration, which I've detailed in the following forum: http://railsforum.com/viewtopic.php?id=42560
Any help would be great. Thanks!
Make sure your Gemfile has a gem 'RedCloth' in it. Regardless of which gems are actually installed in your system, Rails will only use the gems listed in your Gemfile. You do not need the require "RedCloth" statement either.
I had exactly the same error and gem 'RedCloth' line was present in Gemfile. What helped was adding require statement in the beginning of controller file
require 'redcloth'
class StaticController < ApplicationController
...

Rails gem - geoipcity is not being included in the application

I installed the geoip_city gem, and i tested the gem in irb... Now when I am using the gem in the application I get an error
uninitialized constant ApplicationController::GeoIPCity
I guessed it is because I did not add the line
require geoip_city
So I tried adding the line to the function I used the code in, but then I got the error
No such file -- geoip_city
Please help.
Have your require rubygems before ?
require 'rubygems'
require 'geoip_city'

Resources