Add javascript tracker and give Blocmetrics the capability to receive and record events from the js tracker.

OK, I removed the custom message and did a redirect to 404 page with status
404. Spec successfully passes the expect(response.status).to eq(404) test.


On Fri, Jul 25, 2014 at 3:34 PM, David Bahar <dbahar@gwmail.gwu.edu> wrote:

> I’m having a terrifically difficult time with this one. From what I can
> see, for a POST action you don’t usually catch a 404 error. You usually do
> that with GET actions. I keep trying to get RSpec to recognize the error
> code that is being passed back but it looks like the
> ActionRecord::RecordNotFound is overriding the status code.
>
> Talked with Shayon about this and he doesn’t see a way to check for 404 on
> a POST action.
>
> Any ideas??
>
>
>
> On Jul 25, 2014, at 2:51 AM, Oliver Azevedo Barnes <
> notifications@github.com> wrote:
>
> In app/controllers/events_controller.rb:
>
> > +
> > +  def cors_set_access_control_headers
> > +    common_cors_headers
> > +  end
> > +
> > +  def common_cors_headers
> > +    headers['Access-Control-Allow-Origin'] = '*'
> > +    headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
> > +    headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Content-Type'
> > +    headers['Access-Control-Max-Age'] = "86400"
> > +  end
> > +
> > +  def not_found
> > +    respond_to do |format|
> > +      format.html { render :file => File.join(Rails.root, 'public', '404.html') }
> > +      format.json { render :text => '{"error": "App not found."}' }
>
> render text: "App not found", status: 404
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/wasafiri/blocmetrics/pull/7/files#r15393517>.
>
>
>