Rails, my stylesheet disappears magically? - ruby-on-rails

Ok I just started a rails project...when i initially load the page it's styled as it's supposed to be. Without changing any code when I refresh the stylesheet disappears. I figured maybe it was a html/css error, but then if i close my browser and reopen it the page shows up fine again. So it's not that. I'm in dev mode so I don't think it's a cache issue. It happens in both firefox and chromium.

Just give Mongrel or Thin a try

Related

iOS Safari loads a wrong page

I've met a very strange bug when tried to open my web site http://akr-congress2016.ru/ in iOS Safari. Please see the screenshot below.
It seems like some elements are loaded from a completely other web site. The new site is a copy of the old one, but layout files (I'm using Phalcon) are changed. There is no link to the old web site at the page.
Also I've noticed doubled logo, it seems like a rendering bug.
When I refresh the page it is loaded normally.
I'm weird what might make Safari to load some fragments of the page from completely another domain.
The screenshot
Try to remove cache from browser. Or maybe it's just an issue of DNS. In that case you just need to wait untill DNS will get updated.

VS2013 MVC Debug: Chrome Doesn't Reflect Updated File

I was busily debugging an MVC4 app, written in C# under VS2013, using the Chrome debugger. Everything was working fine... until suddenly Chrome stopped reflecting updates to the view I was editing.
In other words, I'd change code in the view in VS2013 (while the server was running), flip over to Chrome, hit reload (or event Ctrl-F5)...and my changes were ignored.
I tried clearing the Chrome cache. No joy.
I tried rebooting the machine. No joy.
What the heck is going on? Feels like there's a cached version of the file someplace which didn't get deleted.
You might want to read the post below:
http://www.asp.net/visual-studio/overview/2013/using-browser-link
The Browser Link controls are located in the dropdown with the circular arrow icon. The arrow icon is the Refresh button.
I have not tried this but according to the post, the Refresh button would reload your changes.
Hope it helps.

Rails 4 favicon in localhost

I created a favicon for a rails app I've built a month ago. Now I'm working on a new app without a particular favicon, yet every time I go to localhost:3000 the old favicon appears. I know it really doesn't matter and it won't appear in production but it bugs me. Can anyone explain why it keeps showing and how can I remove it?
Thanks.
The reason is simple, the browser is being smart and caches the favicon as it associates it with the URL, i.e. http://localhost:3000.
To test it in Chrome, just open http://localhost:3000 in an incognito window (CTRL+SHIFT+N) and you will not see the favicon there.
To remove the favicon, simply clear the browser cache.
It appears in development on localhost:3000 because it got cached.if run your server on different port like 4000(rails s -p 4000) and access localhost:4000 then it won't show you the old favicon.

How can I activate the Firefox debugger?

While debugging a JavaScript program I was writing with Firebug, the Script panel stopped working and I got the following message:
I went through all menus and sub-menus I could find but didn't see a option to re-enable this feature. The console.log() command doesn't work in Firebug as well (while it does work in the built-in devtools' console).
How can I re-activate the Firebug Script panel? What may have caused this?
This may have different causes. One of them is described in issue 5646, which is related to going back and forward in the browser history.
In such cases it normally requires a browser restart to work again.
Note that Firebug up to version 1.12 is based on an old debugger API exposed by Firefox called JSD, which is unmaintained and buggy. Since version 2.0 Firebug uses a new debugger API, which fixes this problem.
Coincidentally, I just "fixed" the same problem with my Firebug.
I went through re-installs, options resets and such and nothing helped.
After some investigation it boiled down to the content of the page I was debugging.
I have a function called by jQuery when page load is finished:
<script>
$(onPageLoad);
</script>
Now, this function asks user to enter his name using prompt() function. It appeared that Firebug wouldn't activate script panel until prompt() is closed. That is not a problem when you have just one page opened since you just close the dialog and everything works. However, it is a problem when you have two same pages opened. Script panel is non-operational until you close both prompts.
I was facing this problem recently. I found that my Firebug was not getting updated because my Firefox was stuck on 29.x. Once I updated my Firefox the new Firebug got installed. It supports only Firefox 30+.
Note: I was using OSX v1.9.3.
I was having same problem, and, thanks to Roman Guralink, I figured out that the the dialogue Firefox prompts you to insert the master password was the cause. When you set a master password for all password stored, FFox usually opens a dialogue to ask it just after program started. BUT, sometimes this dialogu goes behind the main window, and you don't notice it is there.

CSS not updated during debugging ASP.NET MVC application

I am working on a test application based on ASP.NET MVC. I am new to CSS stuff so I am learning that as well.
I have created a master page called "new.master" and created a new css "new.css". I am calling the view from controller as:
return View ("About", "new");
What I am doing is that I am frequently updating the css and master page. So I run the application in debug mode frequently. After sometime I stop seeing the effect of changes in css. When I "view source" in chrome and check the css, it shows an old version.
When I change the name of both master page and css, I start to receive updated views but that works for sometime and then again I stop getting the CSS updates. Have you faced this problem? How can I fix it? (Its terribly annoying!)
Your browser is caching the css. If you force a refresh with F5 that should display any changes.
I think this may be a browser cache issue. In in IE and FF I usually do Ctrl + F5 or Ctrl + Refresh button. Also you can manually clear the cache. For IE you can use the IE Dev Toolbar and for Firefox there is Firebug with both you can clear the cache easily. Not sure about chrome, sorry.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
I found another case in which this can happen.
We started our application with just plain links to the CSS files, then switched to using bundling. We updated the old <link href="#Url.Content("~/somePath/someStyle.css")" rel="stylesheet" type="text/css" /> to #Styles.Render("~/Styles/bundles/someStyle").
We also use a few stylesheets which are only needed for some pages, and they have their own bundle. Now, for one of them, we forgot to change the link tag to the #Styles.Render statement.
The result was that this CSS got updated now and then (so we thought everything is OK; the style wasn't missing), but we could not influence when the update happens. When I started making changes to the file, I realized that nothing I do (emptying the cache, rebuilding the project, restarting Cassini) will trigger an update. The browser always got a 304 Not modified.
So, if you have these symptoms, check your links.
Please use Ctrl+F5 to refresh your browser.
F5 may give you the same page even if the content is changed, because it may load the page from cache. But Ctrl - F5 forces a cache refresh, and will guarantee that if the content is changed, you will get the new content.
hope this will help you
Thank you
go to chroom developer panel by right click inspect -> then go to Network tap -> tick the Disable cache checkbox (note: this should always be checked) -> Refresh the page by pressing F5.
this work for me, hope this help others who have this issue! :)
It's very possible that css is being cached in your browser, so simply clearch browser cache, it should help
This happened to me when I had a master view that would load partial views depending on which partial view the user wanted to see, but the answer from this page helped, https://forums.asp.net/t/1763494.aspx?applying+CSS+layouts+to+a+partial+view
CSS must be referenced in the of the Html document. As a
consequence you cannot include them in a partial view...because in
such case the css is included in the Html body. Please plce the style
sheet in head of the page that hosts the partial view.
I would have css links in my partial views and any modifications to the css files would never happen, even if I pressed Ctrl-F5 in the browser. I also tried clearing cache contents in the developer tools. I noticed by viewing the source stylesheets that the css files linked by the partial views were not changing, so the fix for me was to move the css links from the partial view to the main view where these partial views were to be held.
I had something similar happening to me.
Then suddenly noticed the bundle was added to the page:
#Styles.Render("/bundles/classifiedDetailCss")
instead of:
#Styles.Render("~/bundles/classifiedDetailCss")
Note the missing ~ character in the first example.
(The first example only worked after building the project, otherwise it would return a cached version even in debug mode.)
This can help solve this issues in both dev and production.
use asp-append-version="true"

Resources