Storing user setting

Hi,

Where should i store user settings? Well, I have a class called Book and
one of the fields is called status. When a new Book is created, the
status field is assigned a value according to what the user set in the
setting.
So, I will have a form for the user to change the settings of the app
including the initial status of the Book model.
I’m thinking of using a table to store the settings, but i think it’s a
bit too much.

Thanks,

Andy.

Andy wrote:

Hi,

Where should i store user settings? Well, I have a class called Book and
one of the fields is called status. When a new Book is created, the
status field is assigned a value according to what the user set in the
setting.
So, I will have a form for the user to change the settings of the app
including the initial status of the Book model.
I’m thinking of using a table to store the settings, but i think it’s a
bit too much.

Thanks,

Andy.

Andy - my opinion would be to use a database table. Why would this be
too much? The user settings sounds like something that needs to be
persisted, and the db is the ideal place for storing persistent data,
maybe even the only sensible place. Also, Rails makes it easy to get
stuff in and out of the db so it isn’t much programming effort.

Andy - my opinion would be to use a database table. Why would this be
too much? The user settings sounds like something that needs to be
persisted, and the db is the ideal place for storing persistent data,
maybe even the only sensible place. Also, Rails makes it easy to get
stuff in and out of the db so it isn’t much programming effort.

Well, it’s because there are only a few things that the user could
change, so i thought database is a bit too much.
If i use a database, what would be the best approach to store different
settings? Do i use store a single value in each row e.g. a row to store
the status value, another row to store the default admin’s email, etc?
Or do i store them as a single row under different fields?

One more thing, I’m using the example from the Agile Web D. in
Rails to handle uncaught exception. In my application controller i
declared a method called
‘rescue_action_in_public(exception)’
The thing is, the exception doesn’t get caught. The exception gets
caught if i change the method to
‘rescue_action’
Any idea why?

Thanks,

Andy.

It sounds like you are not trying to store a user setting, but a setting
(or
to be more technically correct, a property or attribute) of the Book.
The
Book should have a status property/attribute and therefore the
corresponding
books table in the database should have a column called status.

Well, it’s because there are only a few things that the user could
change, so i thought database is a bit too much.
If i use a database, what would be the best approach to store different
settings? Do i use store a single value in each row e.g. a row to store
the status value, another row to store the default admin’s email, etc?
Or do i store them as a single row under different fields?

From the sounds of it, you aren’t using a db with your app already? From
that standpoint I understand why the db seems like a hassle, but it kind
of negates the reasons for using a framework like rails to start with.

At any rate, it’s not too little information for the database. You would
probably want to have a ROW for each user, and COLUMNS containing their
settings, as you described last. That way you can make a query for one
unique field (username/id, whatever) and get all of the settigs.