ectomobile/app/controllers/sites_controller.rb

31 lines
472 B
Ruby
Raw Permalink Normal View History

2022-06-08 14:49:54 +00:00
# frozen_string_literal: true
# Gestionar el sitio
class SitesController < ApplicationController
def show
site
end
def create
site.update(site_params)
redirect_to site_path(site)
end
def update
site.update(site_params)
redirect_to site_path(site)
end
private
def site
@site ||= Site.first || Site.create(title: 'Ectomobile')
2022-06-08 14:49:54 +00:00
end
def site_params
@site_params ||= params.require(:site).permit(:title, :logo)
end
end