Last Updated: February 25, 2016
·
2.881K
· alyssa

Rails App w/ No Database

Here's how to setup Rails 3 without active record:

In application.rb, replace

'rails/all' 

with

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"

Also in application.rb, remove/comment out this line

config.active_record.whitelist_attributes = true

In development.rb, remove/comment out these lines

config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5

2 Responses
Add your response

This has most definitely saved me many lost hours as well as gray hairs, thanks!!

over 1 year ago ·

Edit: Sorry, Rails noob (but not complete) here. I misunderstood the first time, hence the edit.

What is active record exactly, and why does my application.rb usually look more or less like (this is Refinery CMS):

 require "active_record/railtie"
 require "action_controller/railtie"
 require "action_mailer/railtie"
 require "active_resource/railtie"
 require "sprockets/railtie"
# require "rails/test_unit/railtie"`     

and
config.active_record.whitelist_attributes = true by default as well.


Ok wait, there's also:

# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql    

My question is: what is this active record fiasco? Is it wanted for 3rd degree murder?

over 1 year ago ·