Sha256: 89ddcc013e977177452e5b8598f3cd0d250e8fa810cda95fc5799bfea0d3e621
Contents?: true
Size: 942 Bytes
Versions: 14
Compression:
Stored size: 942 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, *Mumukit::Platform::Organization::Profile.attributes, *Mumukit::Platform::Organization::Theme.attributes, *(Mumukit::Platform::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
14 entries across 14 versions & 1 rubygems