diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 18ad718..d63f19a 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' } rescue_from CanCan::AccessDenied do |ex| + puts ex.message redirect_to root_url, :alert => ex.message end diff --git a/app/controllers/eventos_controller.rb b/app/controllers/eventos_controller.rb index 5c1084a..09134eb 100644 --- a/app/controllers/eventos_controller.rb +++ b/app/controllers/eventos_controller.rb @@ -1,9 +1,10 @@ require "net/http" class EventosController < ApplicationController before_action :set_evento, only: [:show, :edit, :update, :destroy] - + load_and_authorize_resource + skip_authorize_resource :only => :create before_action :authenticate_user!, only: [:edit, :new] - before_action :verified_request? + # GET /eventos # GET /eventos.json @@ -53,6 +54,7 @@ def create format.html { render action: 'new' } format.json do puts @evento.errors + puts "LALALAL" render json: @evento.errors, status: :unprocessable_entity end end diff --git a/lib/insertar.php b/lib/insertar.php index 85d1a35..4ec1594 100644 --- a/lib/insertar.php +++ b/lib/insertar.php @@ -193,7 +193,7 @@ "latitud" => $objeto["latitud"], "longitud" => $objeto["longitud"], "pagina" => $objeto["pagina"], - "contato" => $objeto["contacto"], + "contacto" => $objeto["contacto"], "precio" => $objeto["precio"] )); $args = json_encode($args);