new/Erb file.html creating .erb file, html missing?

Hi,

I just cut some html out of somewhere and put it in it's own file as a partial. When I click on the layout folder and create a "Erb file.html" file it creates file.erb with no reference to html in the filename.

For example, I clicked on new/Erb file.html and type _header, The file created was header.erb. It should have been header.html.erb.

Can anyone tell me what is going on please? This is really frustrating/strange behavious and seems totally counterintuitive. Surely if you are creating a html.erb file it should create a file of that type? Am I missing something simple? I am new to Rubymine, but I just can't get my head round why it would create an erb file instead of html.erb when that is what you explicitly select. Can you have an erb file on it's own without a filetype? I hadn't heard of it.

Thanks for any light you can shine on this - I am sat here scratching my head.

10 comments
Comment actions Permalink

Maybe this one http://youtrack.jetbrains.com/issue/IDEA-56096 ? Although it does not really looks like it.

BTW -- what template do you use when creating new file? Some specific template .. or just generic "New | File" (no template, blank file) ?

0
Comment actions Permalink

I don't even know what a template is in this context ;) I am just wanting a blank file, which it does create, but it doesn't put the html in the filename, it creates filename.erb.

0
Comment actions Permalink

Well ... my only suggestion (for a blank file with any extension) would be to use "New | File" (the very top entry, above "Directory") and not using any template (any other entry).

0
Comment actions Permalink

Sorry I think you misunderstand me :) I am trying to create a new file.html.erb (ruby on rails file for the preprocessor, html with embedded ruby, just the thing that Rubymine is made for).

I think something must be broke. At the moment I am having to manualy rename and add the .html extension to the "file.erb" so it is "file.html.erb" as when I select "New/File html.erb" from the menu whilst in the directory window on the left, it only gives me "file.erb". It has to be either something elementary or something broken in the editor.

Thanks for trying to help :) I don't mean to sound ungrateful.

0
Comment actions Permalink

I'm not saying that you are doing something wrong. All what I'm saying that as far as I'm aware IDE does not allow you to create file with multiple extensions when using template for whatever the reason is (your  "New/File html.erb" which you can find in "Settings | File Templates"). At the same time "New | File" allows you to create any file (even file with "extension only" e.g. ".htaccess" or ".git" etc) -- you just need to type full file name here (e.g. "file.html.erb").

0
Comment actions Permalink

I'm a bit confused so I am attaching a screenshot with the command I am selecting circled in red.

When I click this command I thought that it would create a new html.erb blank file. But are you saying that I am selecting some type of template? I think I am just not quite getting what you are saying as I have never used a template and thought what I was clicking on would just create a file, but I may be misinterpreting the menu completely.

Have a look and see what you think :)



Attachment(s):
Capture.PNG
0
Comment actions Permalink
But are you saying that I am selecting some type of template?

Yes. And I have provided the "link" already -- "Settings | File Templates" -- the "Erb File.html" template is there -- you can alter it as you wish (by default it is bank).

As you will be able to see there, the extension box has "erb" only, therefore creating a file with name "123" will create "123.erb". If you need "123.html.erb" then you need to type "123.html" when creating it (works just like that in 4.5.3)

0
Comment actions Permalink

That's really strange. It just seems counterintuitive to me. Maybe it should show just erb rather than html.erb?

Thanks anyway for the answer - I will just get used to typing the extension for this one and not for the others.

0
Comment actions Permalink

1) The ticket I have mentioned in my first reply -- it's about the actual reason -- IDE does not allow creating/saving templates (templates, not files) with more than one extension (e.g. html.erb). That's why in such multiple-extensions scenario you have to type 1st extension as part of the file name. Currently nothing can be done in this regard from IDE side (unless this ticket is resolved).

2) If you find this situation unconvenient (confusing template name or whatever) -- create your own template there, give it more appropriate name and use it instead -- at least it may be easier to remember that ".html" part needs to be entered as part of new file name as well.

0
Comment actions Permalink

A bit of RTFM required on my part ;) Thanks for being so patient. I don't agree with the decision but I do understand the reasoning.

0

Please sign in to leave a comment.