1

I have many models in my applications and some of them are closely related to each other so I decided to group them up and make modules. Here is what I did as an example: http://pastebin.com/qqELTd2k

Now I am curious about three things.

Firstly: do I realy need to specify the module name in relationships, if they do not go outside the module (e.g. the 'belongs_to :status' association in the paste) or it should work withought it properly (I do have a model called Status in the root model directory and it is different from Qna::Status).

Secondly: will that :char association work properly, going outside the Qna module?

Third: Is it a good idea at all to group models like that? It makes the models directory much cleaner, but I am not sure about the common conventions.

UPDATE

4th: can I put the qna.rb file discribing the module in the qna folder in app/models? And if yes, what modifications do I need to do (obviously it does not go that easy).

Almaron
  • 4,127
  • 6
  • 26
  • 48
  • Several of those questions can be answered by just trying it. – sevenseacat Mar 17 '12 at 10:10
  • It works right now, but I did not find any corresponding information on the docs, so I am not quite sure if it would work later when the app grows bigger. If you need an example of such behavior try rendering an instance variable in a 1st-level partial of the view and in the third. First will work great, but the third would not. – Almaron Mar 17 '12 at 10:24
  • You shouldn't be using instance variables in partials, but that's an entirely different matter. – sevenseacat Mar 17 '12 at 10:25
  • 1
    The thing is that not everything that works is something you should realy use. – Almaron Mar 17 '12 at 10:30
  • Only one of your four questions is about what you *should* do, the other three are about whether or not you can. – sevenseacat Mar 17 '12 at 10:31
  • Ok then, if you think they are dummy questions, I can escept that, but how about answering that forth, which in your opinion is on the topic. – Almaron Mar 17 '12 at 10:47

0 Answers0