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?
Related
Im in the middle of performing an edge ruby and rails update for a web app built in rails 2.3.18 and running ruby 1.9.3.
I have been incrementally been updating the rails version and fixing breaks and things have been moving forward at a steady pace. I have currently made it to ruby 2.1 and rails 3.2.x.x. and have made the push to rails 4.0.0
I have dealt with alot of breaks and errors since the 4.0.0 update and can now get the server to start using rails s but im now getting a new error.
I cannot find literally anything about this error online so im hoping i'll have better luck here. Thx in advance.
This is the line in my controller that triggers this error. Keep in mind this is not my code. Im updating a 8 year old system.
class WpPosts < ActiveRecord::Base
establish_connection "blog"
end
This is the specific line that is firing off the error, but I get this error wherever the is any active record call. Even simpley calling a model in rails console get me this same error.
Things like calling User in rails console get me that same error.
I have already tried:
gem install activerecord -v=4.0.0
and that still gets me the same error. Ive also unistalled all other versions of activerecord.
There is a very short stack trace wich leads me to believe the railties lib is not loading. Or that maybe theres an issue with the path to that lib.
app/models/wp_posts.rb:1:in `<top (required)>'
app/controllers/default_controller.rb:28:in `start'
this is a screenshot of the top of my application.rb file
I am upgrading my rails 4.2.0 app to 5.1.2 which is going fine. I had used Angular 1.x to enhance my rails app pages selectively. My rails views are in HAML. Here is a snippet of a page which loads fine in 4.2.0, but not in 5.1.2:
.well{"ng-app" => "billing", "ng-controller" => "BillableCtrl"}
= simple_form_for #billable do |f|
.row
.col-md-4
This loads angular fine in this view. However, I get the following stack trace in my javascript console when I try to load this in Rails 5.1.2.
Uncaught SyntaxError: Unexpected token &
angular.self-26d045c60a96c782aa8ef9f5709b1b4fd1ec8578bc37ec2c6c2b9c4370f4bac0.js?body=1:64
Uncaught Error: [$injector:modulerr] Failed to instantiate module
billing due to: Error: [$injector:nomod] Module 'billing' is not
available! You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies as
the second argument.
I am using ngannotate-rails version 1.2.2 in rails 5.1.2 upgrade. The version of ngannotate-rails used in rails 4.2.0 version was 0.15.4.
Has anyone else run into this issue? What are some options to investigate?
It turned out NOT to be an angular problem but a Rails to Javascript messaging problem. Take a look at the following line code in one of my javascript functions:
$scope.billable_item = #{#billable.to_json};
Up until Rails 4.2.0 in my experience, this was the standard way to pass the Rails data into javascript. However, for some reason that I do not understand yet, it is broken. That was causing Angular to throw very confusing messages. I have been using the 'Gon' gem to pass data from Rails to Javascript for some time and I switched to that which worked fine. I will now switch my entire Rails to Javascript communication to the Gon gem.
An application I work on is using Rails 3.2.18 and Active Record 3.2.18. It was using Ruby 2.0.0, but someone from DevOps needed to upgrade to Ruby 2.2.4 today. Once users started making traffic on the site, everything started to explode. The administrators can't even access Active Admin.
After digging into this for quite some time, I realized I was thrown off by an error I was constantly seeing:
NoMethodError: undefined method `name' for nil:NilClass
Since some of my models have a name attribute, I assumed this was the culprit.
Long story short, the issue is with calling size on an Active Record has_many relation that has not yet been loaded into memory. Here is how I can demonstrate this in Rails' console:
model_instance = MyModel.find(12345)
model_instance.some_relations.size
# the error from above will be thrown (nomethoderror on name: for nil)
model_instance.some_relations
model_instance.some_relations.size
# it works fine and produces expected output
Also, model_instance.some_relations.count will always work (though I do understand the differences between count and size).
I have found surprisingly little on this issue. There is a related GitHub issue here, but I can't prove it's the same issue I am having.
I am going to rollback my release which upgrades to Ruby 2.2.4 for now, but was wondering if anyone can shed some light on this. Is there a bug between Active Record 3.2.18 and Ruby 2.2.* ? Is the only solution, assuming I need to upgrade to Ruby 2.2.4, to upgrade Rails as well?
This is indeed a conflict between Rails 3.2.18 (and a few other patch versions) and Ruby 2.2.*. It is documented here.
Aside from updating to a supported version of Rails, which may not be viable solution for some production applications, the Rails version could be updated to branch: 3-2-stable.
Attempting to run migration for my Rails app pixel_paisan is getting an error reading; NoMethodError: undefined method `boolean_label_class=' for SimpleForm:Module. Gist for the trace at https://gist.github.com/nbarnes/9796454dc28be9792284. Source code for error-production app at https://github.com/nbarnes/pixel_paisan.
I've tried uninstalling and reinstalling simple_form, doesn't help. Update entire gemset, doesn't help. Different ruby versions via RVM, doesn't help. Plain vanilla Rails app, created in an attempt to reproduce the bug works fine. Google doesn't know about my issue.
Does anybody know anything about this? I'm rapidly running out of angles to attack it from.
Short answer: update your simple_form gem to 3.1.0+. You have simple_form (3.0.2)
Longer answer: See https://github.com/rafaelfranca/simple_form-bootstrap/issues/44 which seems to be someone who had the same issue where the answer is to upgrade to simple_form 3.1.0+ whereas your Gemfile has simple_form (3.0.2)
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?