apps/workbench/app/controllers/actions_controller.rb
def star
    links = Link.where(owner_uuid: current_user.uuid,
                       head_uuid: @object.uuid,
                       link_class: 'star')

    if params['status'] == 'create'
      # create 'star' link if one does not already exist
      if !links.andand.any?
        dst = Link.new(owner_uuid: current_user.uuid,
                       tail_uuid: current_user.uuid,
                       head_uuid: @object.uuid,
                       link_class: 'star',
                       name: @object.uuid)
        dst.save!
      end
    else # delete any existing 'star' links
      if links.andand.any?
        links.each do |link|
          link.destroy
        end
      end
    end

    respond_to do |format|
      format.js
    end
  end
# star / unstar the current project
star / unstar the current project
star / unstar the current project
def star
    links = Link.where(owner_uuid: current_user.uuid,
                       head_uuid: @object.uuid,
                       link_class: 'star')
    if params['status'] == 'create'
      if !links.andand.any?
        dst = Link.new(owner_uuid: current_user.uuid,
                       tail_uuid: current_user.uuid,
                       head_uuid: @object.uuid,
                       link_class: 'star',
                       name: @object.uuid)
        dst.save!
      end
    else 
      if links.andand.any?
        links.each do |link|
          link.destroy
        end
      end
    end
    respond_to do |format|
      format.js
    end
  end
def star links = Link . where ( owner_uuid : current_user . uuid , head_uuid : @object . uuid , link_class : 'star' ) if params [ 'status' ] == 'create' if ! links . andand . any? dst = Link . new ( owner_uuid : current_user . uuid , tail_uuid : current_user . uuid , head_uuid : @object . uuid , link_class : 'star' , name : @object . uuid ) dst . save! end else if links . andand . any? links . each do | link | link . destroy end end end respond_to do | format | format . js end end
star / unstar the current project
star / unstar the current project
# create 'star' link if one does not already exist # delete any existing 'star' links