Setting Access-Control-Allow-Origin for a rails application

I was experimenting with AngularJS and using Rails as a backend and needed to enable Access-Control-Allow-Origin for $http. Here is a simple snippet I created that does the trick. If you were doing this in production, I would assume Apache or Nginx would be the appropriate place for this code. However, this is just a POC.

# application_controller.rb
after_filter :local_access_control_headers

def local_access_control_headers
  headers['Access-Control-Allow-Origin'] = 'http://localhost:8000'
  headers['Access-Control-Request-Method'] = '*'
end

Well planned and executed marketing by Wegmans

Wegmans isn’t just a super market around here, it’s a destination. Going the store is less about “getting food” and more about shopping. My local store is huge, but it feels comfortable. The selection is massive, but I can always find what I came for. I can also find things that I didn’t come for and didn’t know I wanted until I saw them. So how can Wegmans accomplish this? How can they have a massive store, but yet have items that catch my attention that I wasn’t specifically looking for. The answer: The Wegmans Magazine Continue reading Well planned and executed marketing by Wegmans