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. -- Posted via http://www.ruby-forum.com/.
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. On 5/1/06, Andy <ihapaantuh@hotmail.com> 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. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060501/a24b9759/attachment.html
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. -- Posted via http://www.ruby-forum.com/.
> 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 Development 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. -- Posted via http://www.ruby-forum.com/.
> 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? Fromthat 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. -- Posted via http://www.ruby-forum.com/.