Gem 'better_errors' not working Rails 5.0.0 - ruby-on-rails

I installed gem better_errors version 2.1.1 for my ruby on rails application. However, I still get the same old debug page. I have also installed the gem binding_of_caller. I even installed the three gems which as shown as runtime dependencies for better_errors, namely erubis, coderay and rack(see the gem page here). All this to no avail.
I have also tried other solutions, one is this. All this to no avail.
I am using Ubuntu 16.04, rails 5.0.0.1 and ruby 2.3.1p112.

Make sure you are not testing with just a routing error / 404 exception, as that will no longer end up triggering better_errors.
Best way to confirm whether it's working or not would be to put some undefined variable in a controller action and then hitting that URL.

You installed the gem in development?
'group :development do
gem "better_errors"
end'
I just added better_errors to my Rails 5 app and its working fine.

Related

What's the replacement for acts_as_commentable in Rails 6, Ruby 3.0.2?

I upgraded our app to Rails 6.1.4.4 and Ruby 3.0.2. I have this old gem
gem 'acts_as_commentable'
Locked at version 4.0.2. The gem does not appear to be supported anymore, which is a shame because when I start up my app or console, I now get this error
$ rails c
Your Gemfile lists the gem rspec-rails (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
/Users/myuser/.rvm/gems/ruby-3.0.2/gems/hash_dot-2.5.0/lib/hash.rb:19:in `method_missing': undefined method `arity' for {:as=>:commentable, :dependent=>:destroy}:Hash (NoMethodError)
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:53:in `build_scope'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:47:in `create_reflection'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:32:in `build'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations.rb:1458:in `has_many'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/acts_as_commentable-4.0.2/lib/commentable_methods.rb:58:in `acts_as_commentable'
…
Is there any simple replacement for this gem or way to monkey-patch this error so I can start up the app?
Looking over the forks, I found this one that appears to work for me using Rails 6.0.6 and Ruby 3.0.5.
https://github.com/alazycoder101/acts_as_commentable.git
I have not tested it extensively yet, but at least the basic functionality seems to be working for me. Hope this helps.
For clarity, to use that fork you would use the following line in your Gemfile:
gem 'acts_as_commentable', git: 'https://github.com/alazycoder101/acts_as_commentable.git'

Does RUBY on RAILS 4.0.2 work with MS SQL Server Express?

I've googled this to death and I'm just going around in circles.
I'm on a Windows Server 2008r
I installed and put the following in my Gemfile
gem 'ruby-odbc' # I think the version is the.9999 one?
gem 'tiny_tds', "~> 0.6.1"
gem 'activerecord-sqlserver-adapter' # I've tried a few versions of this 3.2.8 and 4.0
I get varying errors depending on how many times i've bundle installed or updated
Errors include activesupport and activerecord versions not found. They are installed
Or I get alias_method errors.
Can someone just point me in the right direction of what I should do. Some discussions seem to think that there is nothing that works at the moment. Would downgrading to an older Rails work? If so how and which version?
activerecord-sqlserver-adapter hasn't been released for Rails 4.0 yet but the gem is 95% ready. You can use put it in your Gemfile like this:
gem 'activerecord-sqlserver-adapter', github: 'rails-sqlserver/activerecord-sqlserver-adapter'
For a description of the outstanding work take a look at Failed Tests & Segfault on this pull request.

Rails 4/Heroku '404 not found' page

I have been following Michael Hartl's ruby on rails screencasts, however I have the older Rails 3 ones and not the videos for Rails 4. So far it hasn't been much of an issue, but I would like to have my app deploying to heroku and following his instructions leads me to a 404 not found page for the home screen.
When navigating around (i.e. manually entering in pages/home) it brings me to the static HTML pages, but doesn't load any CSS etc.
I looked through Heroku's site and they mentioned to install rails_serve_static_assets. I did
gem install rails_serve_static_assets
bundle install
as well as added rails_serve_static_assets to my Gemfile like this:
group :production do
gem 'thin'
gem 'pg'
gem 'rails_serve_static_assets'
end
Everything pushes just fine, it says it's deployed, but when I refresh the page it still gives me a 404 not found page.
What do I need to do to have it deploy correctly?
Thanks in advance!

Bootstrap Devise Cancan Rails - Rspec Failure

I just installed Rails3 Bootstrap Device Cancan in my local machine and ran rake spec but I'm getting all test failures with below error in common:
undefined local variable or method 'postgresql_version' for #<ActiveRecord::ConnectionAdaptors::SQLite3Adaptor:0x489dff8>
I'm not sure why I'm getting this since I followed the instructions on https://github.com/RailsApps/rails3-bootstrap-devise-cancan carefully.
I'm currently running this on Windows 8 and used Bitnami RubyStack to run CMD
I ran into the same problem and this is how I resolved it.
It looks like there is a problem with version 1.1.0 of database_cleaner. See "database_cleaner >= 1.1.0 is broken for SQLite" (https://github.com/gregbell/active_admin/issues/2388). I updated my Gemfile to set
gem 'database_cleaner', '< 1.1.0'
then ran "bundle install" and after it completed, "rake spec" ran cleanly.
Double-check your database.yml. Refer to Configuring Rails Applications, Section 3.12, Configuring a Database.
Did you intend to use sqlite3? Is sqlite3 in your Gemfile? Naturally, SQLite3Adaptor will not respond to postgresql_version! Can you include a few more lines of the stack trace?
I doubt this has anything to do with devise or cancan.

How to config ferret 0.11.5-mswin32 and acts_as_ferret 0.4.4 on Rails 3

I'm using Rails 3 and I want to use ferret in my app. I installed ferret 0.11.5-mswin32 (because i work on windows 7) and acts_as_ferret 0.4.4.
In my Gemfile I have:
gem 'ferret'
gem 'acts_as_ferret'
Then when I start the server I get this error:
Could not find gem 'ferret (>= 0)' in any of the gem sources listed in your Gemfile.
I have tried with
gem 'ferret', '0.11.5'
gem 'acts_as_ferret', '0.4.4'
and I still get the same error.
What do I need to put my Gemfile to get ferret working?
Thanks
The docs on acts_as_ferret stipulate you need version 0.5 or greater for rails 3, and ferret 0.11.8 (I would use 11.8.4 since it is the only release of the gem in 4 years...and that is a bit of a red flag).
No offense, but why are you using ferret?
A few years ago, that was a good idea, but since then other search engines have been better adopted and supported (sphinx, elastic search, solr).

Resources