Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable ActiveRecord in Ruby on Rails 5

I am a newbie in Rails.

I want to disable ActiveRecord in Rails 5.

I've already found several answers Here, Here and Here

But none of them seems working for me.

Would you help me with this issue, please?

Thanks.

like image 287
spymukite Avatar asked Jan 30 '23 01:01

spymukite


2 Answers

Just to update, there is no need to delete anything by hand if you are using Rails 5 or greater.

For new rails application in Rails version 5 or newer, all of these are handled. Just run the rails new command with -O (--skip-active-record) argument.

> rails new proj_no_db -O

For api only Rails application without DB,

> rails new proj_api_no_db -O --api
like image 71
ibaralf Avatar answered Feb 07 '23 07:02

ibaralf


Accepted answer in this post of mechanicalfish is right.

But in my case, I've done following 2 additional things (I've used Rails 5.1.2)

Delete model files in models directory

models/application_record.rb

models/widget.rb

Hope this helps!

like image 42
smupyknight Avatar answered Feb 07 '23 09:02

smupyknight