Thu 4 Apr 2019 6:49PM

Plugin example not working

ELP Edward L Platt Public Seen by 103

Hi, I've followed the example for creating a plugin ( https://help.loomio.org/en/dev_manual/plugins/ ) but the "Hello, World!" message is not printed when I run "rails c". Any suggestions on how to get this working?

I've tried adding plugin.enabled = true, but no luck. Here is the most recent code I've tried (placed in plugins/loomio_tags/plugin.rb):

# plugins/loomio_tags/plugin.rb
module Plugins
    module LoomioTags
        class Plugin < Plugins::Base
            setup! :loomio_tags do |plugin|
                # our code will go here!
                plugin.enabled = true
                puts "Hello, world!"

Rob Guthrie Fri 5 Apr 2019 8:18PM

Oh dear. The example is very out of date. To fix this, put another directory in your structure.. so plugins/dev/loomio_tags/plugin.rb

However, I would enquire what functionality you want to add to Loomio.

We're rewriting the front end client right now, and I don't expect any plugins with frontend code will work with this new system.

What are you trying to do?


Edward L Platt Fri 5 Apr 2019 9:28PM

We're using loomio to conduct some research on large-scale group deliberation and need to add some experimental functionality. The timing is unfortunate if our work won't be useful in the future, but we're just about ready to start running our experiments. Maybe we'll be able to update the plugin for the new front end if it proves useful.

More info on the research if you're curious: https://medium.com/@elplatt/building-consensus-through-deliberation-in-large-collaborations-organizations-and-cooperatives-79d28c3e3acc


Rob Guthrie Fri 5 Apr 2019 9:34PM

I'd love to know, in detail, what changes you're making as I suspect it's in line (or could inform) the changes we have planned for the year.

We're planning on making all poll types configurable, so people can invent their own processes and share them as templates.


Edward L Platt Fri 5 Apr 2019 9:40PM

Oh, exciting! Specifically we're working on assigning participants in a discussion to "breakout groups" such that they can have conversations with a smaller group of people, while allowing administrators to shuffle groups and change the visibility of content from all groups.


Rob Guthrie Fri 5 Apr 2019 9:57PM

Would further levels of sub groups support what you need?


Edward L Platt Fri 5 Apr 2019 11:01PM

We need a many groups to one poll structure, so I don't think it would. Our research results might still apply though. Many of the things we need for the study are specific to a research setting and might not be useful in practice, but it sounds like some of the work you're doing could be a good starting point for us.


Rob Guthrie Fri 5 Apr 2019 11:28PM

If love to setup a chat to understand if you have time.


Edward L Platt Tue 9 Apr 2019 5:31PM

I'd like that! It's a busy time of the semester, but perhaps towards the end of the month or early May?


Edward L Platt Tue 9 Apr 2019 5:32PM

By moving the plugin to the plugins/dev directory, we were able to get the example plugin to run. However, now we're finding the following error when we start rails c:

PG::DuplicateTable: ERROR:  relation "tags" already exists (ActiveRecord::StatementInvalid)
: CREATE TABLE "tags" ("id" bigserial primary key, "group_id" bigint, "name" character varying, "color" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)

Any idea what we're doing wrong?


Rob Guthrie Mon 15 Apr 2019 12:14AM

remove the database calls from your tags plugin to fix this.


Edward L Platt Fri 12 Apr 2019 2:20PM

Alternatively, is there a currently working example of a loomio plugin?


Rob Guthrie Mon 15 Apr 2019 12:25AM

I feel it is fair to warn you that we've never had anyone external to Loomio write a plugin - you're the first. Having noticed this to be the case, I've not kept the plugin work current, because it has not added any value for so long.

Also I'm not very happy about how the plugin system works. I think that we should just be using Rails Engines for server functionality.. and then for the client, well, we're rewriting the entire frontend.. almost at beta stage - with no plugin support available in the new client at this stage. It can come but it's not a priority for me because it's not adding value that I can see.

A plugin system can be a really valuable thing - and in the future I can imagine us supporting Vue client plugins and rails engines. But as we do massive change work on the app to keep moving it forward, we need to break things like this.

I think a discussion about your work, and how to best go about what you want to do, would be a good thing to do. I'd be happy to have a call and help.