Adding an attribute to a ActiveRecord::Base instance

I have an instance of ActiveRecord::Base called Site. Is it possible to
add attributes to that class in code, like so

class Site < ActiveRecord::Base
belongs_to :user
attr_accessor :type_site_boolop, :type_program_boolop, :books_only

I don’t want those additional attributed in the DB. The problem is that

@site =
@site.type_site_boolop = ‘foo’

@site.attributes does not include type_site_boolop. Any ideas?

Thanks again, I’m new too Rails and this forum has been most helpful


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs