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?
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?
On 8 May 2011 11:08, Tiago V. [email protected] 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?
Put them in the database.
Colin
Hi Colin,
I see how could that go, but what If my configurations are of different
types?
Is there a gem that provides some helper methods that you could
recommend?
I am using rails 3.
Tiago V.
[email protected]
On 8 May 2011 17:49, Tiago V. [email protected] 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
On 8 May 2011 21:54, Tiago V. [email protected] wrote:
I am understanding better what you mean.
Please don’t top post, it makes it difficult to follow the thread.
Insert your reply at appropriate points in the previous message.
Thanks
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.
As I suggested in my previous post, have one table with a single row
and a field for each configuration value.
Colin
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 V.
[email protected]
On May 8, 4:54pm, Tiago V. [email protected] wrote:
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
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
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs