Fearless Fool wrote in post #971153:
> Marnen Laibow-Koser wrote in post #971089:
> [snip]
>> That's easy enough.
> [snip]
>> No, you probably don't [want a generic Model, View and Controller
>> for a Restaurant, and then sub-classes for specific restaurants].
>> What you probably want is a fairly generic Restaurant object with
>> some sort of configuration property.
> [snip]
>> You can use namespaced models, views, and controllers. But your
>> architectural approach is almost certainly wrong.
>
> Marnen:
>
> Methinks you keep your copious wisdom too under wraps. You answer makes
> it clear that you think my approach is wrong, but doesn't really explain
> Marnen's One True Way! :)
What part was unclear? I'll be happy to elaborate.
>
> A search for
>
> site:http://guides.rubyonrails.org/ namespace
>
> shows me about namespaced routes, namespaced forms, but nothing about
> how to organize files and classes to have namespaced models, views and
> controllers.
Use directories corresponding to the namespaces; that way the autoloader
knows where to find the files.
>
> Perhaps my question is too general, so I can re-frame it: is there an
> example (on github or in Rails itself) that shows a good way to do this
> kind of thing?
>
> TIA.
There should be lots of explanations of dealing with namespaced classes
in Rails.
>
> - ff
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
Sent from my iPhone
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment