Sam Kong
Sam Kong

Reputation: 5810

Easy way to find a view file in rails?

I develop rails applications with my designer who has minimum knowledge about rails. She works on Windows through file-sharing from a Linux server. She always has hard time finding view files to work on.

I usually use 'grep' to find a view file. But she can't.

If you have a good suggestion, please share with me.

I have an idea which may be overkill. Is there a way to automatically add comments around view files (including layouts and partials?) in html file?

Like this:

<!--Starting app/views/some_dir/some_file.html.erb-->
HTML here...
<!--Ending app/views/some_dir/some_file.html.erb-->

This way, my designer can find the file very easily. Of course, this should be automatic and development environment only.

Thanks.

Sam

Upvotes: 5

Views: 667

Answers (1)

twe4ked
twe4ked

Reputation: 2892

I use the Rails Footnotes gem (https://github.com/josevalim/rails-footnotes) in some of my projects which allows me to click a link in the footer of my app that opens the current view (also shows partials) in TextMate. Not sure if it could be customised to work with a Windows text editor but you could look at the URL to work out the file name.

I.e to open a file in MacVim, it creates the following link:

mvim://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml

and for TextMate:

txmt://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml

Upvotes: 5

Related Questions