2012-03-10 18:08:39 +01:00
|
|
|
class Prefs < ActiveRecord::Base
|
|
|
|
|
|
|
|
validates_presence_of :theme,:locale
|
|
|
|
|
|
|
|
has_one :user
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def self.create_default(user)
|
|
|
|
Prefs.create(:user_id => user.id,
|
|
|
|
:theme => $defaults['theme'],
|
|
|
|
:locale => $defaults['locale'],
|
|
|
|
:msgs_per_page => $defaults['msgs_per_page'],
|
2012-03-26 20:22:01 +02:00
|
|
|
:msg_send_type => $defaults['msg_send_type'],
|
|
|
|
:msg_image_view_as => 'attachment',
|
|
|
|
:msg_image_thumbnail_size => '192x144'
|
2012-03-10 18:08:39 +01:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO move refresh to prefs and make refresh page with messages
|