[Rails] Re: Constants and Configurations

2011-05-09 Thread Simon Baumgartner


On May 8, 4:54 pm, Tiago Veloso ti.vel...@gmail.com wrote:
 I am understanding better what you mean.

 I was referring to if you have a config that is of boolean type, another 
 config that is integer and another that is of float type. I was picturing  
 one table per type.

 Tiago Veloso
 ti.vel...@gmail.com

 On May 8, 2011, at 20:27 , Colin Law wrote:







  On 8 May 2011 17:49, Tiago Veloso ti.vel...@gmail.com wrote:
  Hi Colin,

  I see how could that go, but what If my configurations are of different 
  types?

  I don't understand what you mean.

  Is there a gem that provides some helper methods that you could recommend?

  I don't know of one.  It hardly seems worthwhile for a table with one
  record and whatever fields you want.  Perhaps I don now understand
  your comment above.  You are thinking of one row per item.  Instead
  make it one record with a field for each constant of whatever type is
  appropriate.

  Colin

  --
  You received this message because you are subscribed to the Google Groups 
  Ruby on Rails: Talk group.
  To post to this group, send email to rubyonrails-talk@googlegroups.com.
  To unsubscribe from this group, send email to 
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/rubyonrails-talk?hl=en.


Hi Tiago,

I don't know the details of your problem but you might wanna look into
a NoSQL solution. It will add some overhead in setting it up but it
could be a nice fit for your problem.
I don't have a complete overview of all NoSQL solutions but Redis or
MongoDB should be a good fit.

That said, you will most likely be able to do anything you need with a
regular relational DB (as laid out by Colin). It really depends on
your overall problem set if it makes sense to add something new into
your system.

Hope that helps!

Simon

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Constants and Configurations

2011-05-09 Thread pepe
I believe I know what you are trying to ask. I had to setup something
similar for an application of mine. I have one table with one column
for each value type (boolean_value, string_value, integer_value,
decimal_value and datetime_value) and a 'code' column for values such
as 'timeout minutes'.

In my maintenance pages I have the code field and 5 other fields, one
for each column type. So far I have not used the datetime_value field
but you never know. I validate that one and only one of the value
fields is entered and make sure that if the chosen field is the
boolean_value one it is either true or false to avoid mistakes such as
the user not entering any values on the screens and pressing Enter.
Another thing I am doing for security purposes is that once the record
has been created the user must 'unlock' the code field in the editable
pages to be able to change it and when he/she does an alert is
displayed saying that if the code value is changed the application
might stop working.

I hope this helps.

On May 8, 6:08 am, Tiago Veloso ti.vel...@gmail.com wrote:
 Hi,

 Right now I have some Constants in my application that serve as
 configurations for my application. I would like to make these
 configurations editable by the users/admins through views.

 What is the best strategy to do this?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.