Error deploying to Heroku using Mongoid - ruby-on-rails

I am getting an error on a view when I move my app to Heroku that I am not getting in development or locally in production mode.
I started with the Devise Mongoid app from railsapp.github.com and added bootstrap.
When I deploy to Heroku I get the following error on the Devise navigation parcial,
ActionView::Template::Error (can't convert Array into String):
Im using Mongoid 3.0.0.rc
I think it's related to Mongoid because I was able to get it work originally with 2.4.10 but now I get other errors with that version.
Also, If I comment out the lines in the parcial where it errors, it loads the root okay but eventually crashes out if I navigate around.
I'm running out of ideas!
I can post logs or configuration files if that would help.

Its known and being worked on.
https://github.com/mongoid/moped/issues/21
Advice downgrading back to what you were using for. 3.0.0.rc is also giving me some heroku issues

Related

Why do I suddenly get a blank screen with Rails on localhost?

I have combed through lots of references to this issue (most recently followed tips on this post, but nothing helped.
Here's the issue: I already have a Rails app that works-or used to work on localhost:3000. But then, suddenly I get blank screens with the same app. The app works with no problem in rails console. The default Rails screen shows up too. The more I read abut blank screens, the more I am lost.
So the sequence of events--all potentially could be complicating factors:
I run the Rails via CLI.
I also have MAMP installed to work with a WordPress site locally.
At one point, either before MAMP or after MAMP, I installed Brew. (All were done following online instructions.)
Not long ago, I tested out a simple Rails app on Heroku, which at first worked, but then the app no longer could be updated. After much tinkering, I removed rbenv and the problem went away (ie my Rails app could be updated on Heroku again).
All of these issues seem to be related. But are they? How do I find out?
Rails 5.2.1
Ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
What do you mean by suddenly went blank? Look for before/after steps you took. Also, check the Rails logs to see what's wrong. This might also be useful: https://stackoverflow.com/a/39476142/888278

Rails 3.2.25 upgrade to 4.0.0 - "uninitialized constant ActiveRecord" on all active record queries

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

Can't create a new Spree app: "undefined method `raise_in_transactional_callbacks='"

I had this issue a couple of months ago, posted it on Spree's GitHub page, then figured out the solution myself and posted it on that same issue. Two months later, I'm still getting comments on that same issue from Googlers who had the same error message, so I figure it's worth posting my solution on this website as well just in case anyone is having the same problem but isn't looking on GitHub.
The issue: trying to create a brand new Spree app, following the exact instructions in Spree's documentation, gives the following error when you try to run spree install --auto-accept or rails g spree:install:
undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
Solution below...
The problem: I'd created a new rails app with rails new, which had automatically created an app using rails 4.2.0beta. Then I had issues with gem incompatibilities, so I'd changed the version number of a few gems, including downgrading Rails back to 4.1.8.
BUT the config setting raise_in_transactional_callbacks is new in Rails 4.2.0, so in earlier versions of Rails it will raise an error. If you're getting this error message you need to remove the line config.active_record.raise_in_transactional_callbacks = true from config/application.rb.

Rails NoMethod Error when calling a dynamic attribute find

I am currently working on an app. In this app, I created a Person model and I was using rail's dynamic attribute find feature. In the Person model I have an attribute called uid, so I was calling Person.find_by_uid(some numerical value). This worked fine in my development mode and the app was totally functioning. However, once I deployed this app to heroku. The app failed and the log complains about NoMethodError (undefined method `find_by_uid' for #):
I have been looking all places, but still unable to track down the problem. I tried to define the method find_by_uid under the Person model, and still does not work.
I was wondering if anyone has had similar experience or knows how to solve this issue?
Thank you very much ahead of the time!
Did you try running the migrations in heroku (heroku rake db:migrate)? Most provably that attribute is not in the heroku data base so you don't have that dynamic method.
I ran into the same problem. heroku restart has saved me.

Rails 2.3.9, adding ActiveScaffold, getting in `alias_method': undefined method `number_of_pages' for class `Paginator'

I have AS (as a plugin) working in another app just fine (I dont remember this
issue...) - its also using Rails 2.3.9, on same dev box.
Now trying to add it to a new app and getting this error when running
the webrick, script/server:
/Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.9/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method':
undefined method `number_of_pages' for class `Paginator' (NameError)
from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/
activesupport-2.3.9/lib/active_support/core_ext/module/aliasing.rb:
33:in `alias_method_chain'
from /Users/kimptoc/Documents/ruby/borisbikestats/vendor/plugins/
active_scaffold/lib/extensions/paginator_extensions.rb:9
I couldn't find any previous references to this error.
Embarassingly I dont know which version of AS I am using successfully... it says 1.2RC1 in the CHANGELOG file, but I seem to remember trying a few of the forks...(is there somewhere I can see which fork is in use...). I have tried using the the 'main' activescaffold in the new project, but it fails as above, but so does using the same plugin that is in the working project :(
Thanks in advance for any pointers as to what I am doing wrong.
Thanks,
Chris
PS Just realised that new Rails was using Rails 3 and old/working one was 2.3.9. It seems you need to use an alternate branch of AS for Rails 3, like this : https://github.com/vhochstein/active_scaffold/wiki
This is just a guess, but built in pagination was removed in Rails 2 as I recall, and you needed to install the classic_pagination plugin to get that functionality back.
I only used ActiveScaffold once, but the error there says paginator_extensions.rb ... it's probably monkey patching the old Rails paginator? Therefore the class exists but the number_of_pages method doesn't.

Resources