Rails View-Path Lookup

I wonder if it's possible, to customize the lookup path of views for rubymine? I have the following folder-structure:

app
-- views
---- frontend
------- default

and want rubymine to find the views in the default folder instead of the standard views folder.It would be very cool, if theres a way to archive this.
But I think that it would be in general a nice feature, to be able to customize such paths (views, locales)

Sebastian

9 comments

I don't think it is good idea. Remember about Rails conventions. If you want to place you views in app/views/frontend directory you must create a namespaced controller for example app/controllers/frontend/main for Main::FrontendController class - views will be placed in app/views/frontend/main/, tests test/functionals/frontend/main_test.rb . I am quite sure that RubyMine will handle this.

0

Hi guys,

I completely agree with Sebastian about Rails conventions and views.
However you can change location of locale files by adding property i18n.locales.folder to file rubymine.vmoptions.
E.g.:
-Di18n.locales.folder=foo
This will make RubyMine look for locale files under foo folder of your problem.

Regards,
Oleg

0

Sure, in general this won't be a good idea, but in this particular project i am currently working on, this is a requirement. We have implemented a theming support for our application, which allows us to have default views, which could be overridden for a particular client

Here is an example:

app
-- views
-- -- default
-- -- -- controller1
--- -- --- index.html.haml
-- -- client1
-- -- -- controller1
-- -- -- -- index.html.haml
-- -- client2

When the app is serving client1, the index.html.haml from its theme directory will be served, but for client2 there were no modifications needed, and so we can serve the default view. The Implementation inside rails is really straight-forward and we are happy with this. But I wouid be even happier, if i now can tell rubymine, where to find the default views.

Sebastian

0

Hi Oleg,

thanks for the tip concerning the locale path. I will try that.
Is it possible, to set multiple locale-paths?

e.g: folder = foo;bar

Sebastian

0

Is it possible, to set multiple locale-paths?

e.g: folder = foo;bar 

Not yet. Is it really useful for you?

Regards,
Oleg

0

Hm, multiple paths are not really neccesary, as long as one path is deeply indexed. At the moment i split the locales in topic-separated files, but with a growing project it gets a little bit confusing, when searching the right file. So it would be nice, when the locale folder is deeply indexed by rubymine (maybe its already done? i have checked this 2 months ago).

0

RubyMine does recursive search for locale files.

Regards,
Oleg

0

Perfect, thanks for your help.

Sebastian

0

would be really useful with RadiantCMS. Extensions have a config/locale directory so there are a lot of files to consider. and as they all are called like the language itself it would be grate to get a hint on were the file comes from in the add i18n value dialog

cu edi

0

Please sign in to leave a comment.