Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define Rails::Engine in the Agent GEMs created #27

Merged
merged 4 commits into from
Jan 5, 2020
Merged

Define Rails::Engine in the Agent GEMs created #27

merged 4 commits into from
Jan 5, 2020

Conversation

alessio-signorini
Copy link
Contributor

While building an agent as a GEM I found some difficulties adding a custom UI due to the views paths scope.

This PR declares a Rails Engine inside the GEMs created by this module so they will be able to define additional models, views, controller and routes.

Once #2659 is merged in the main Huginn codebase, it will be sufficient to create a partial in app/views/agents/agent_views/<agent_name>/_show.html.erb to have it appear in Huginn exactly as if it was located in the main codebase.

@alessio-signorini
Copy link
Contributor Author

Existing agents can take advantage of this just adding

class Engine < ::Rails::Engine; end

in their /lib/huginn_whatever_agent.rb file.

Copy link
Collaborator

@dsander dsander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like a very clean solution overall!

@dsander dsander requested a review from knu January 5, 2020 10:28
Copy link
Member

@knu knu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@knu knu merged commit 91e2fef into huginn:master Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants