Bootstrap and cmd's SUBST function just collided and destroyed my views - ruby-on-rails-3

So, I'm on Win XP (Macs are expensive, alright?) and I found this link which made my life SO much easier. I changed my path from:
C:\Documents and Settings\DevAdmin\rails_projects\arcwmi_reports>
to
R:\arcwmi_reports>
So much nicer!
But, when I went to create a new project and I added #import "bootstrap" to my custom.css.scss file, I suddenly got this error on my site:
Showing R:/arcwmi_reports/app/views/layouts/application.html.erb where line #5 raised:
different prefix: "C:/" and "R:/arcwmi_reports/app/assets/stylesheets"
(in R:/arcwmi_reports/app/assets/stylesheets/custom.css.scss)
Here's line #5:
<%= stylesheet_link_tag "application", media: "all" %>
I know this line is the problem because if I comment it out, or the #import "bootstrap" then my stuff works fine.
One of those lines of code is trying to use the old prefix. I don't know which.
What is going on here?!??!
Thanks -Chip

So the issue is that I started my rails server on the R:\ substitute and for some reason the stylesheet_link_tag conflicted with the server request.
As soon as I shut down the server and re-started it using the full path, the page loads fine.
I don't know why this creates such a conflict, but it seems the server catches the error and won't load the page.
This is a rubber duck moment, I guess.

Related

Resharper cannot resolve partial view inside master page

I've upgraded from ReSharper 7 on vs2012 pro to ReSharper 8.1 on vs2013 pro, and ReSharper is now warning me a lot of my partial views cannot be resolved.
It seems to be only happening:
In ASP master pages (i.e. not razor)
When the .ascx partial is in the same controller folder as the partial
E.g. Home.Master, located in ~/Views/Home/Home.Master renders UserProfile.ascx, located in ~/Views/Home/UserProfile.ascx.
Both <%: Html.RenderPartial("UserProfile") %> and <%: Html.RenderPartial("~/Views/Home/UserProfile.ascx"%> are flagged by ReSharper as invalid.
Additionally, shared partials in the ~/views/shared folder seem to be picked up fine when I reference just by name:
However, referencing the view by path doesn't seem to work:
(NB. Both images are taken inside Home.Master, in ~/Views/Home)
When I run the application, the partials work correctly, so it seems to be a change in ReSharper 8.1. Is there anything I can do to fix this?
It's a bug in ReSharper.
The best thing for now is to set it to ignore this type of error.
You can do this by selecting 'inspection options' from the 'red light bulb' on the left hand side and setting it to another option. Hopefully it will be fixed soon!
Edit: See this ticket for the problem. http://youtrack.jetbrains.com/issue/RSRP-395642
There's a simpler fix I've got around it by using relative references. So in my case I had a view in another project (and if you try to go outside of the current project without starting with a forward slash "/" you'll get a warning like this. For your problem change the line that reads
<%Html.RenderPartial("UserProfile")%>
to
<%Html.RenderPartial("../../Views/Home/UserProfile")%>
or
<%Html.Partial("../../Views/Home/UserProfile.cshtml")%>
Not sure if this is the exact path in your solution but hopefully you understand what I am saying - you cannot use the tilde (~) symbol. You have to use HTML's navigation symbol. Not ideal obviously but I dare say it is better than changing inspection rules.
Also - if you do need to remove an inspection, just comment it out by adding the line
// ReSharper disable once Mvc.PartialViewNotResolved
... // code goes here
or
// ReSharper disable Mvc.PartialViewNotResolved
... // code goes here
// ReSharper restore once Mvc.PartialViewNotResolved
You can use T4 templates POCO string properties to generate the paths. It's a good idea to update these T4 generated classes regularly and use them inside your code.
I was getting this error today from ReSharper 2018.2.3 when did this:
#Html.Partial("_StatusMessage", Model.StatusMessage)
I also noticed a warning from the IHtmlHelper.Partial method itself:
Use of IHtmlHelper.Partial may result in application deadlocks. Consider using <partial> Tag Helper or IHtmlHelper.PartialAsync.
So I changed the code to:
<partial name="_StatusMessage" model="Model.StatusMessage" />
That fixed it for me.

video.js.map throwing a 404 (Not Found)

Playing around with the newest video.js today, I'm noticing that video.js.map is showing up as a 404 when putting the video.js script into a site that I'm working on.
I don't see a source map file in the initial distribution, but it doesn't throw this error locally, only when I put it on a server.
Ideas as to solving?
You have a few options when you don't have access to a source map:
Ignore the message. It generaly only gets thrown when your dev tools are open.
Remove the reference in the original file. These are the last characters (comments) at the end of the file.
Generate a source map yourself when you have access to the source code. For video.js, it can be generated from video.dev.js.
Use a public CDN version which might not link to the source map.
There also is a discussion on GitHub about this topic.
I get the same error, everything should still work though. I think it's an html5 or browser bug
I was seeing this as well, but only in my log files. I was getting three multi-line entries (failures) every time a video was played in my production.log in a RoR site. It was really bulking up my .log file. More info on #smhg's 2nd bullet (remove references). I'm using video.js 5.4.6 along with some vpad-vast plugin stuff - I could see all three files referenced in my .log file. Your mileage may vary.
Edit video.js and remove the following entry on line 19694:
//# sourceMappingURL=video.js.map
(for vpaid-vast plugin only...)
Edit videojs_5.vast.vpaid.min.js and remove this line from the very end:
//# sourceMappingURL=videojs_5.vast.vpaid.min.js.map
Edit videojs.vast.vpaid.min.css and remove this line from the very end:
/*# sourceMappingURL=videojs.vast.vpaid.min.css.map */
The entries are no longer appearing in my log file and the player works fine.
Hope it helps!

Page not working Attempt to unlock a mutex which is locked by another thread

I want to start my app and it's still "loading". It worked in the morning, but now it doesn't .
I tryied with other ports, switching to a stable branch, restarting computer, but nothing seems to work. On other apps, it's working. If I stop de server this is the error I see(in the browser)
Attempt to unlock a mutex which is locked by another thread
WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10) at localhost:3000
Had the same problem lately. It looks like there are two view partials calling each other in a loop.
Go to the view which is called when you visit the root path and try commenting out any calls to 'render'.
<%#= render ... %>
If your page works now (with missing parts), uncomment that line, have a look at the partial you are trying to render and repeat the process with 'render ...' in that one.
Finally you should be able to make out what caused the loop.
I had exactly the same problem. In my case the problem was that I was creating indexes on the database (MongoDB 2.4.9) and that blocked the whole database. As soon the index creation was done the error message disappeared again. Obviously this error message appears if something is blocking.

How do I report bugs to the rails team?

I found a weird bug in Rails 3.0.? that I want to report to the Rails team, but I have no idea how to do it.
Does anyone here know how to do this? Where is the open source project hosted? Do they have have ticket system?
Actually, I am going to share the issue I found, maybe it really isn't a bug. I am using Rails 3.0.7 and Ruby 1.8.7.
I created some static pages and I have two pages that are named very similar one named "holiday" and the other named "holidays". First, I created the singular "holiday" page and everything worked as it should. Then I created the plural version of it and when I tried to test it didn't work, I kept getting redirected to the not found or 404. Just to be clear, yes I restarted the server but that didn't fix the problem. The only way this weird issue went away in when I cleared the browser cache.
Here are the code snippets.
In the routes I added this:
match '/holiday' => 'pages#holiday' , :as => 'holiday'
match '/holidays' => 'pages#holidays' , :as => 'holidays'
in the controller I just added empty actions
def holiday(); end
def holidays(); end
somewhere in the views folder I have the corresponding pages "holiday.html.erb" and "holidays.html.erb".
When I visit the first page (/holiday) it works. The page gets served.
When I visit the second page (/hoidays) it doesn't work. I get redirected to the not found / 404 page.
Has anyone encountered this weird issue in Rails 3?
Here's the bugs/issues system:
https://github.com/rails/rails/issues
You can search for the bug before submitting it. Maybe someone already reported it.

Rails3 UJS response not evaluated

It gives me the creeps,i'm done, i need some help here, i reverted multiple times back but i can't find the error.
Simple controller (customers),a simple form for adding a customer via :remote => true and the controller does respond_to do |format| { format.js } . Works fine, renders my create.js.rjs template.
I work for a few hours without making any javascript changes or changes to my controllers or authorization etc.. and when i try it again it's not working anymore.
What i mean with not working: Controller gets called, record saved, all partials rendered. But no javascript evaluated, not even a simple alert(1) at the beginning of the file.
I tried with different prototype.js versions and different rails.js versions, but nothing helped. I hope someone has a clue about this or already experienced this.
It's not that i don't want to post code. But it won't help. Its basic code that works and, after some changes where i don't know what i really changed (some locales here, some css there, html templates from a completely different controller a bit..)..
Currently developing with: ruby 1.9.2, rails 3.0.3, prototype 1.7 RC3, rails.js from github.
SOLVED
How stupid, I missed the part where the template naming changed. My application templace was named "application.rhtml". It worked until now. As it stopped to work, I changed it to "application.html.erb" and now it's working.