Rails.application.routes.draw do
  mount Knock::Engine => '/knock'

  resources :spaces, only: [:show, :create, :update, :destroy]
  resources :spaces do
    resources :copies, only: [:create]
  end

  resources :users do
    resources :spaces, only: [:index]
    get :memberships, to: 'user_organization_memberships#user_memberships'
    post '/account/synchronization', to: 'accounts#synchronization'
    get '/account/new_subscription_iframe', to: 'accounts#new_subscription_iframe'
  end

  resources :organization, only: [:show]
  resources :organizations do
    resources :spaces, only: [:index]
    get :members, to: 'user_organization_memberships#organization_memberships'
    post :members, to: 'user_organization_memberships#create_by_email'
  end

  resources :user_organization_memberships, only: [:destroy]
end

Rails.application.routes.draw do
  mount Knock::Engine => '/knock'

  resources :spaces, only: [:show, :create, :update, :destroy]
  resources :spaces do
    resources :copies, only: [:create]
  end

  resources :users do
    resources :spaces, only: [:index]
    get :memberships, to: 'user_organization_memberships#user_memberships'
    post '/account/synchronization', to: 'accounts#synchronization'
    get '/account/new_subscription_iframe', to: 'accounts#new_subscription_iframe'
  end

  resources :organization, only: [:show]
  resources :organizations do
    get :spaces, to: 'spaces#index'
    get :members, to: 'user_organization_memberships#organization_memberships'
    post :members, to: 'user_organization_memberships#create_by_email'
  end

  resources :user_organization_memberships, only: [:destroy]
end

Make spaces resource more specific to help out members post
Make spaces resource more specific to help out members post
