views:

44

answers:

2

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?

+4  A: 

Convention over configuration man. Suck it up.

Jason Punyon
I 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
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