Sha256: aa9e3bc9670a52c76536bfa8af9aeb3e610351dc040a72b122a64e0c71ecada3
Contents?: true
Size: 509 Bytes
Versions: 12
Compression:
Stored size: 509 Bytes
Contents
module Property class Label attr_accessor :post def name "label" end def create(params) new_label = ::Label.find_or_create_by!(name: params[:value]) labels = post.labels labels << new_label post.labels = labels post.save! new_label end def destroy(params) label = ::Label.find_by!(name: params[:value]) labels = post.labels labels.delete(label) post.labels = labels post.save! label end end end
Version data entries
12 entries across 12 versions & 1 rubygems