Skip to content

Instantly share code, notes, and snippets.

@shernade
shernade / Parser.rb
Last active December 25, 2015 02:39
This class parse a hash of params looking for a date field and parse its value to timestamp
class Parser
def initialize(hash)
@hash = hash
end
def parse()
@hash.inject({}) do |h, (k, v)|
h[k] = parse_element(k, v)
h
end
@shernade
shernade / facebook.rb
Created November 16, 2016 12:35 — forked from a14m/facebook.rb
Gist for manually OAuth2 facebook for Rails APIs
# lib/omniauth/facebook.rb
require 'httparty'
module Omniauth
class Facebook
include HTTParty
# The base uri for facebook graph API
base_uri 'https://graph.facebook.com/v2.3'
=> Booting Puma
=> Rails 6.0.4.1 application starting in development
=> Run `rails server --help` for more startup options
Exiting
/home/sergio/.rvm/gems/ruby-3.0.2/gems/activemodel-6.0.4.1/lib/active_model/attribute_assignment.rb:30:in `assign_attributes': When assigning attributes, you must pass a hash as an argument, ActionDispatch::Routing::RouteSet passed. (ArgumentError)
from /home/sergio/.rvm/gems/ruby-3.0.2/gems/activerecord-6.0.4.1/lib/active_record/core.rb:324:in `initialize'
from /home/sergio/.rvm/gems/ruby-3.0.2/gems/activerecord-6.0.4.1/lib/active_record/inheritance.rb:70:in `new'
from /home/sergio/.rvm/gems/ruby-3.0.2/gems/activerecord-6.0.4.1/lib/active_record/inheritance.rb:70:in `new'
from /home/sergio/.rvm/gems/ruby-3.0.2/gems/actionpack-6.0.4.1/lib/action_dispatch/middleware/stack.rb:37:in `build'
from /home/sergio/.rvm/gems/ruby-3.0.2/gems/actionpack-6.0.4.1/lib/action_dispatch/middleware/stack.rb:136:in `block in build'