On Saturday, 25 August 2012 12:44:00 UTC-5, Michael Pavling wrote:
>
> On 25 August 2012 18:40, Dave Castellano <[email protected]<javascript:>> 
> wrote: 
> > "Generated" questions are generated by a "method" I write.  When a 
> > generated question is picked, the method I wrote is called and it 
> > returns an "instance" of the question, its correct answer, and its 
> > explanation.  Each time the question is called it generates a slightly 
> > different version of the question. I plan to have hundreds of these 
> > methods.  Currently each is a separate file. 
>
>
> What do these generated methods look like? Are they very similar to 
> each other? Do they follow some sort of pattern? Could that be turned 
> into some form of configuration information? 
>


I think I would rather store the information as a sprintf string in the 
same table and then grep for %s and/or add an extra column on the table 
that holds the type of dynamic question it is so that you can have a single 
method that transforms itself based on that column and then just does 
something like `"hello %s, how are you?" % 'Jordon'` but you can do that 
for complete phrases and such.  This makes it so you have a single method 
for both dynamic and "static"...  Or you could do that with I18n but I 
still prefer to keep those in the database and cache them into memory as I 
pull them out of the database.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/3dG5r7Dno5EJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to