Skip to content

Instantly share code, notes, and snippets.

View zainalmustofa's full-sized avatar
🎯
Focusing

zainal mustofa zainalmustofa

🎯
Focusing
View GitHub Profile
@zainalmustofa
zainalmustofa / serialized_cookie_decrypt
Last active February 7, 2023 09:35
SerializedCookieJars decrypt cookies devise
@zainalmustofa
zainalmustofa / crypt
Last active February 7, 2023 09:35
Ruby AES Encrypt using OpenSSL
require "openssl"
require 'base64'
KEY = "***************************************"
ALGORITHM = "AES-256-ECB"
def self.encrypt(message, iv)
cipher = OpenSSL::Cipher.new(ALGORITHM)
cipher.encrypt()
cipher.key = ENV["KEY"]
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
mount APIBase => "/api"
end
Rails.application.routes.draw do
resources :photos do
collection do
get 'search'
end
end
# or
resources :photos do
get 'search', on: :collection
resources :photos do
get 'preview', on: :member
end
Rails.application.routes.draw do
resources :photos do
member do
get 'preview'
end
end
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
Rails.application.routes.draw do
namespace :api do
resources :articles, :comments
end
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
Rails.application.routes.draw do
resource :photos
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
Rails.application.routes.draw do
resource :photos
end
{
"items": [
{
"countries": [
{
"id": 192,
"name": "Aceh",
"cities": [
{