Looking at a few different ways to execute javascript in rails 3.1. By default all javascript is compiled into one file and embedded in anonymous functions which all execute on each page.
We often want to be selective in how our javascript executes, based on controller and actions. We look at 3 different approaches
use selectors based on form id
use selectors based on css classes on the body
namespaced javascript objects
if you know of any other approaches I would love to hear those as well
I recommend you click the HD link on the player and view it on Vimeo in full screen mode, this embed version is not so crisp.
I went to check on the price of DSL, I've been a long time Comcast customer and getting tired of the high cost. So I went to check it out on AT&T - all I can say is WTF?
Select 'DSL without phone', but then my choices are everything except what I am looking for?
I think they need to go back and do some more QA
Now I get to choose my phone service - WTF: I selected 'without phone service' for a reason
You can install all of the dlls using Nuget, search for Simple.Data.MongoDB and install that package it will bring in the rest
Some of the errors I received on my journey
From Simple.Data
Message=No valid exports were found that match the constraint '((exportDefinition.ContractName == "Ado") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "Simple.Data.Adapter".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.
And from mongo driver when my connection string was not in the correct format, I was using the wrong port
Message=No connection could be made because the target machine actively refused it 127.0.0.1:
With very little code we can fix asp.net MVC AuthorizeAttribute
What problems does it have? Too much redirection.
When making ajax calls a HTTP 401 (Unauthorized) would be better than a redirection
If I am already logged in but access a secure resource (controller / action) redirecting to the login page is far from ideal, an access denied view makes more sense
When is the built in redirection appropriate? When making standard HTTP request and the user is not authenticated.
it turns out it is relatively easy to fix these issues
inherit AuthorizeAttribute
override HandleUnauthorizedRequest
#1: Ajax request should not return redirection / html response
if the user cannot authorize an action and the request is made via ajax we don't want 200 or 302 response codes
we do want 401 Unauthorized, but we have to settle for a 403 Forbidden
The code to fix this
#2: Authenticated users should not redirect to the login page, they should get an Access Denied page
The code to fix this
Turns out very little code is needed - but seems like some of this should just be built in? Using the 401 response won't work because the asp mvc framework must be picking that up later on and forcing the redirection to the login page, the 403 is not ideal but it is effective.