What is the preferred way to implement customization in a Ruby on Rails 3 application?

I am creating a Rails 3 application that will have custom settings (appearance, functionality, etc.), and I was looking for simple advice on what is the preferred way to actually implement the settings.

Do you prefer to have a special model for this material? Are hashes acceptable for storage in a database field? Do you prefer cookies or database sessions? Is an STI Object Better?

Perhaps list some pros or cons for each other method, if you can.

Thank.

+5
source share
2 answers

, , . . User User_configuration, .

class User < ActiveRecord::Base
  has_one :user_configuration
end

class UserConfiguration < ActiveRecord::Base
  belongs_to :user, :dependent => :destroy
end

, ,

class User < ActiveRecord::Base
  serialize :preferences, Hash
end

http://api.rubyonrails.org/classes/ActiveRecord/Base.html

: - ,

: -

, .

+3
+2

All Articles