Undefined method raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
Your config/application.rb
has the following line:
config.active_record.raise_in_transactional_callbacks = true
This is not a valid configuration value in your version of Rails. You will need to delete it or comment it out to continue.
Note: this error and the one that preceded it are indicative of an incomplete Rails version change. If you are in the early stages of a tutorial, you might seriously consider restarting your application using your preferred version of Rails from the very start. This will help you avoid this type of error until you are more familiar with the technology.
undefined method `raise_in_transactional_callbacks=' for # Class:0x0000000460c328 when connecting to localhost
Go to your config/application.rb
and comment the line:
config.active_record.raise_in_transactional_callbacks = true
Please help, undefined method `raise_in_transactional_callbacks=' for # Class:0x007fc3b02ed058
Remove this line:
config.active_record.raise_in_transactional_callbacks = true
from application.rb.
source
Can't create a new Spree app: undefined method `raise_in_transactional_callbacks='
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
.
NoMethodError: undefined method `type' for # Class
Change type
to type_name
as type can be only use for STI.
validates :name, :type, presence: true
to
validates :name, :type_name, presence: true
Rails undefined method `[]' for nil:NilClass
Try this
def initialize
super
@session_types = Array.new
@program_id = ''
end
You were very scarce with pasting your errors, but that's the first thing that comes to mind. Please post the entire error if this doesn't help.
The reason for that is your Setting
class inherits from ActiveRecord::Base
, calling super
first calls parent's initialize
method, this way you add functionality to the method (extend it). Without super
you override it, meaning you replace everything it does by default (like for example connecting to the database, validating) by your code.
ActiveRecord::RecordInvalid: Validation failed: Left side must exist
Problem solved in this issue.
As @pixeltrix stated:
Hmm, looks like the one of the belongs_to associations on the
constructed join model isn't pointing to the right column so is seen
as nil. Previously this wasn't a problem but since we require
belongs_to associations by default now it blows up. The easy fix is
just to put optional: true on the :left_side association when it's
constructed but I think we can do better than that /p>
NoMethodError undefined method 'each' for :String
You defined events(association) and you tried to assing string on events
it raise error.
You can not assign string to association. if you create events
string column on user model. you should change events
column name or change events
association(has_many) name. This makes conflict.
Related Topics
Unresolved Specs During Gem::Specification.Reset:
How to Display Ruby on Rails Form Validation Error Messages One At a Time
Is There an Inverse 'Member' Method in Ruby
How to Use Define_Method to Create Class Methods
How to Use "Rvm --Default" on Macosx
Rails Installation Failed on Ubuntu With "Cannot Load Such File - Mkmf"
Gem Eventmachine Fatal Error: 'Openssl/Ssl.H' File Not Found
Ruby Basic Data Type Conversion
Pass a Variable into a Partial, Rails 3
Ruby - Net/Http - Following Redirects
Installing Jekyll Without Root
Nomethoderror When Trying to Invoke Helper Method from Rails Controller
Rails 3.1 Limit User Created Objects
How to Format a Date in Ruby to Include "Rd" as in "3Rd"