I'm trying to build a survey application with the rapidfire gem. I can create a question group but when I try to answer a question i get the error undefined method primary_key?
Does anyone know why I'm getting this? I'm using ruby 1.9.3 and Ruby on rails 3.2.16
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 developing a simple gem. as part of it, I want data-caching to which I need rails gem. I included the required statements in gemspec. But still, it is not loading Rails. I am getting below error
NameError:
uninitialized constant FormattingHelper::Rails
Instead of using Rails for caching, I used below class and fixed the problem
ActiveSupport::Cache
when i'm following this guide gcm_on_rails, i get some error
when i try execute 'rails generate gcm_migrations' on my console, i get error like below :
while trying to load the gem 'gcm_on_rails'.
Gem Load Error is: undefined method `attr_accessible' for #<Class:0x0000000121c298>
Did you mean? attr_accessor
how to fix it?
i'm trying to implements google cloud messaging on browser
need help
As mentioned in A Guide for Upgrading Ruby on Rails:
Rails 4.0 has removed attr_accessible and attr_protected feature in favor of Strong Parameters.
So if you're into Rails 4.0, you can use Protected Attributes gem for a smooth upgrade path or you can also do what was suggested in this related SO post - Undefined Method attr_accessible by using strong parameters.
I hope those given options work for you.
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.
I'm building my first Rails app and trying to integrate active_paypal_adaptive_payment with Rails 3.2.1, however when I try to boot up the rails server it runs into the problem of, "undefined method 'class_inheritable_accessor' (in line 4 of post_date.rb) in the activemerchant-1.5.1 gem of which is a dependency.
I've looked around and seems this method has been removed in rails 3.2. From what I understand, it's not as simple as going into the activemerchant gem and replacing class_inheritable_accessor with class_attribute (read this conversation).
Any ideas on how I could update this gem so it could be compatible with Rails 3.2? It's an outstanding issue on the github page so appreciate any help with it!
This particular commit solved my issue: https://github.com/cmezak/active_paypal_adaptive_payment/commit/c6661704c45b73a0be5c608c673b106ac1eb5b69