In an application I am building I am storing an XML file in my database using the acts_as_tree
association. I would like to name the class XMLElement
but this throws rails off since the capitalization is non-standard. It is looking for XMLElement
from the file name xml_element.rb
. I tried changing the filename to x_m_l_element.rb
to try and trick it into thinking that "XML" was really two words, but this didn't work either. Should I just suck it up and use the name XmlElement
instead of the more ideal XMLElement
, or is there a better way around this issue?
views:
44answers:
2I figured that was the easiest solution, but I didn't know if there was a way to configure it, For example, Rails lets you configure the name of your database table if you have a name you like better, so I thought there might be a way to configure this as well. I take it there isn't?
Bryan Ward
2009-10-30 23:25:57
A:
Yes you should use XmlElement.
Not only for this example but about every aspect of an application it will never pay off to veer off conventions. There is so much 'magic' going under Rails' hood that it's just not worth it.
allesklar
2009-10-31 07:34:21