How did I start getting this warning in Rails, without changing anything? - ruby-on-rails

This morning I started getting the following warning when running tests.
DEPRECATION WARNING: <% %> style block helpers are deprecated. Please use <%= %>.
I can see how to fix the warning.
How is it possible to start to get a warning without changing any code or updating any gems?
Working in Rails 3, Ruby 1.92.

According to section 7.4.2 of the Rails 3.0 release notes, <%= is the standard for helpers that insert content. So, you must've had the deprecation warning when using a Rails 3 application according to the documentation, but perhaps you never noticed it.

Maybe you switched rvm environments and got a completely different set of gems?

Related

Rails 5 to Rails 6 upgrade breaks partial rendering

I'm upgrading an app from rails 5.2 to 6.1.7, as well as upgrading ruby from 2.6.10 to 3.0.5. Now all of the <%= render "partial_name" %> blocks in the erb view files are broken and throwing the error undefined method safe_append= for {:add_to_stack=>true}:Hash with the hint: safe_append= is being called on a add_to_stack object, which might not be the type of object you were expecting. This appears to be a deprecated ActionView::StreamingBuffer method. I did ensure that actionview has also been updated to 6.1.7, and I'm also not seeing any streaming buffer breaking changes in Rails 6 or 6.1. I don't see any related issues online anywhere. Anyone know what could be causing this?

How can I disable ActiveSupport::Notifications on Rails 7?

I'm trying to upgrade my API from Rails 6 to Rails 7, and got this error after solving dependences and running my app:
Error:
ActiveSupport::Notifications::InstrumentationSubscriberError (Exception(s) occurred within instrumentation subscribers: NoMethodError, NoMethodError)
I never use this feature, searching all my files doesn't exist any mention to this Notifications.
Couldn't identify who and why is calling this notifications and neither find on Rails 7 Docs how can I disable this feature to solve my problem. Anyone know how can I do it?
Tried remove completely the ahoy_matey gem that appears in traceback and change de API mode to false on config/application.rb but both doesn't work.
I expect disabling this feature can fix my problem.
I was getting this exact same error, and the listed solution didn't work for me.
My specific error was an old version of the Airbrake notifier library (v10, updating the v13 fixed it), but to track it down I looked at the error page, which included the NoMethodError error traces below the main application trace.
So if this happens to you, hopefully you won't lose two days to it like I just have. 😬
after spend few hours searching the docs of rails 7, I finally found it. Right here, where it says:
Controls behavior when parameters that are not explicitly permitted are found. The default value is :log in test and development environments.
:log to emit an ActiveSupport::Notifications.instrument event on the unpermitted_parameters.action_controller topic and log at the DEBUG level
The solution was add config.action_controller.action_on_unpermitted_parameters = false on my config/application.rb file.

Why i am getting error of wrong no of arguments in link_to rails 4.2?

I am working on app of Rails 4.2 and facing an unusual issue as below.
**ERROR**
wrong number of arguments (given 3, expected 0..1)
on link_to with syntax
<%= link_to 'In Progress', letters_path(status_filter: 'In Progress') %>
Please find attached screenshot for reference. This seems very much strange to me as I am not able to find any issue with code.
Routes
FULL TRACE
Do you really need bartt-ssl_requirement gem, like 孙悟空 said: try to take it away to check if that's the cause of the problem - It's on the top of the stack trace.
As said on the readme bartt-ssl_requirement is compatible with ruby 1.8.7 and 1.9.x.
Did you recently upgraded your app to rails 4?

"Did not recognize your adapter specification" turbolinks-related error in Rails 4

I was following the Getting Started part of the Rails Guides and created the welcome controller as per the tutorial. I started the server and opened http://localhost:3000/ and instead of the <h1>Hello, Rails!</h1> it was supposed to see, I got the error Did not recognize your adapter specification.
The error block was just some HTML from the application.html.erb file, this was the offending line:
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
If I remove this line from the file, it works as expected. I googled the error and it I saw it could have something to do with the json or coffeescript gems. I have those gems installed and up to date, along with the rails and turbolinks gems, and as far I can tell they all seem to be working fine.
This is not essential, but I'd like to have turbolinks working in my Rails apps. It also feels bad to be clueless about what is wrong. How can I solve this?
I just ran into this problem again and googling again I found this question, with a similar problem.
I downgraded the multi_json gem to version 1.7.8 in the bundler, as mentioned there, and I stopped getting the error. I have yet to see if it will work in Heroku, but it's apparently solved the issue in development. If it doesn't, I'll update this answer.
This is a github issue here: https://github.com/intridea/multi_json/issues/132 which was closed four months ago, reading the comments I found that one of the files had been named .css rather than .scss in the rails project. Maybe the same error is happening with your project. I had the same exact issue and downgrading my gem worked.

Turn on html_safe for the entire app in Rails 3

Rails 3 turns off the html_safe option by default. I want to revert this thing. I have a rails 2.3.8 app getting converted to rails 3. Almost every page breaks because of the rails3 default html_safe setting. Is there any way I can revert this to where it was in previous versions of rails ? Please help
No, there isn't and even if there is, you shouldn't.
It's a good habit to test (and update) your app using the rails_xss plugin in Rails 2.3.x before actually starting the conversion to Rails 3.
Also, you should have a valid test suite in place so that every error will be spotted by the test suite and you can easily fix it.
Don't try to upgrade unless you have completed these two simple steps. There are also a few other suggestions.
As a side note: Current versions of Rails 3 HTML-escape also non-HTML templates, which is a bug. See: https://rails.lighthouseapp.com/projects/8994/tickets/4858
I'm posting this here, because I found this question while investigating the bug mentioned above, but didn't fine that ticket or anything about this bug on the interwebs. (Bad google skills?) Hope it saves someone time.

Resources