lml / quadbase

Quadbase.org - Question Banking Made Easy
quadbase.org
Other
18 stars 11 forks source link

put variated_content_html reader and writer into a module #77

Open jpslav opened 12 years ago

jpslav commented 12 years ago

Or better yet, create an attr_accessor with a default value option

Right now, code is copied across question_setup, answer_choice, question.

zapcannon99 commented 12 years ago

Let me try this then I like small things XD

jpslav commented 12 years ago

OK, see lib/asset_methods.rb as an example (and looking in the code for "AssetMethods"). Ditto for lib/content_parse_and_cache.rb

The idea is to put code that is repeated into one file that is included in the various places it is used.

On Jun 1, 2012, at 9:33 AM, zapcannon99 wrote:

Let me try this then I like small things XD


Reply to this email directly or view it on GitHub: https://github.com/lml/quadbase/issues/77#issuecomment-6061747

zapcannon99 commented 12 years ago

So I looked up things, and I think the current code already does what you want

attr_accessor_with_default is deprecated in Rails 3.2, so that's probably why I think wither we stick with the same or go with a module of course, your call

zapcannon99 commented 12 years ago

Of course, github doesn't update realtime, so I didn't get the hint you wanted a module until just now

zapcannon99 commented 12 years ago

I'm assuming that you want the module in quadbase/lib right?

jpslav commented 12 years ago

Yes

On Jun 1, 2012, at 10:12 AM, zapcannon99 wrote:

I'm assuming that you want the module in quadbase/lib right?


Reply to this email directly or view it on GitHub: https://github.com/lml/quadbase/issues/77#issuecomment-6062732

jpslav commented 12 years ago

Require that file in config/environment.rb

Rachel has done this if you need help

On Jun 1, 2012, at 1:26 PM, zapcannon99reply@reply.github.com wrote:

is there something special about including a module I run tests, and it keeps telling me that VariatedContentHTML has not been initialized (it's my module)


Reply to this email directly or view it on GitHub: https://github.com/lml/quadbase/issues/77#issuecomment-6067154

zapcannon99 commented 12 years ago

oh okay thanks

zapcannon99 commented 12 years ago

I forgot to ask From what I am seeing, these things are supposed to randomize some portion of a question right?

jpslav commented 12 years ago

Yes this is part of question randomization, but for the most part I don't think you'll have to worry about that to implement this issue. You should just see the same code in a couple of places, it should go into a module that is included from those places.

On Jun 1, 2012, at 2:44 PM, zapcannon99 wrote:

I forgot to ask From what I am seeing, these things are supposed to randomize some portion of a question right?


Reply to this email directly or view it on GitHub: https://github.com/lml/quadbase/issues/77#issuecomment-6069187

zapcannon99 commented 12 years ago

so for some reason, the module doesn't work for me however, just making a attr_accessor with nothing after it seems to work fine I'll be trying to break this for a while

zapcannon99 commented 12 years ago

and I broke it

zapcannon99 commented 12 years ago

nvm JPS helps tons