Sha256: 8f97b6b1aa498557c4f26131ae14b8ec5ce8a8368c15d6b7e6de5af4d53d5672
Contents?: true
Size: 933 Bytes
Versions: 72
Compression:
Stored size: 933 Bytes
Contents
module OrganizationsControllerTemplate extend ActiveSupport::Concern included do before_action :set_organization!, only: [:show, :update, :edit] before_action :set_new_organization!, only: :create end private def set_new_organization! @organization = Organization.new organization_params @organization.validate! end def set_organization! @organization = Organization.locate! params[:id] end def protection_slug @organization&.slug end def organization_params params .require(:organization) .permit(:book, :name, *Mumuki::Domain::Organization::Profile.attributes, *Mumuki::Domain::Organization::Theme.attributes, *(Mumuki::Domain::Organization::Settings.attributes - [:login_methods]), login_methods: []) .tap { |it| it.merge!(book: Book.find_by!(slug: it[:book])) if it[:book] } end end
Version data entries
72 entries across 72 versions & 1 rubygems