Comments (11)
I monkey patch these in my projects.
class Team
include Mongoid::Document
include Mongoid::Timestamps
field :whatever, type: String
There should be a cleaner way.
from slack-ruby-bot-server.
I attempted to do that but couldn't get it to work.
Not sure what I did incorrectly, is there a special way I need to tell rails to load the new class other than placing it the models directory of Rails?
from slack-ruby-bot-server.
I don't think so. Example: https://github.com/dblock/slack-sup/blob/master/slack-sup/models/team.rb
Put up a small app and show how it's not working?
from slack-ruby-bot-server.
I'll try and put something together to demonstrate. (Leaving some notes here to help me in a bit.)
Rails Version: 7.0.4
Ruby Version: 3.1.2p20
Gist: https://gist.github.com/Altonymous/96fb6c07294b86de0ea343ce007a4dbe
from slack-ruby-bot-server.
Here's an example I put together, hopefully this is what helps.
https://github.com/Altonymous/example_app/blob/main/README.md
from slack-ruby-bot-server.
Found this StackOverflow, finally. (Google-fu Skill: +1)
https://stackoverflow.com/a/48665268
The "answer" doesn't do it, but the one made by "Carles Jove i Buxeda" seems to work for the example_app I posted. (I haven't updated it yet, in case this isn't a good way to handle it.)
Going to see how it works in my actual application now.
from slack-ruby-bot-server.
@Altonymous Thanks. I'd like this to be documented, but even more I'd like https://github.com/slack-ruby/slack-bot-on-rails to be updated to the latest version of slack-ruby-bot-server and its libraries. Maybe you can help?
from slack-ruby-bot-server.
Hi all, is there a way to extend the Team model? I'm using Rails 6 btw.
I've tried:
# lib/extensions/slack_ruby_bot_server/team.rb
module Extensions
module SlackRubyBotServer
module Team
extend ActiveSupport::Concern
included do
def self.color
'blue'
end
end
end
end
end
# config/initializers/slack_ruby_bot_server.rb
require 'extensions/slack_ruby_bot_server/team'
SlackRubyBotServer.configure do |config|
config.oauth_version = :v2
config.oauth_scope = ENV.fetch('SLACK_OAUTH_SCOPE').split(/\s*,\s*/)
end
Rails.application.config.to_prepare do
begin
if ActiveRecord::Base.connection.table_exists?(:teams)
SlackRubyBotServer::Models::Team.include(Extensions::SlackRubyBotServer::Team)
end
rescue ActiveRecord::NoDatabaseError
end
end
But couldn't find how slack ruby bot server exposes the model's directory.
It says: uninitialized constant SlackRubyBotServer::Models (NameError)
Could you help me?
from slack-ruby-bot-server.
I still just monkey-patch the Team
class, e.g. https://github.com/dblock/slack-sup2/blob/main/lib/models/team.rb, open for someone contributing a better mechanism.
from slack-ruby-bot-server.
Where to put this new team model? I did put it on models
directory but couldn't make it work on Rails.
from slack-ruby-bot-server.
If you want to upgrade https://github.com/slack-ruby/slack-bot-on-rails and try adding it to that I can take a look.
from slack-ruby-bot-server.
Related Issues (20)
- How to integrate this lib with a Rails app? HOT 6
- Extract slack-ruby-bot-server-realtime HOT 1
- gem 'cursor_pagination' is conflicting with rails model generator HOT 2
- https://slack-ruby-bot-server.herokuapp.com no longer has a mongodb HOT 2
- oauth_authorization_url_mismatch for new slack apps HOT 5
- Migration guide for legacy Slack apps to Granular Scopes
- Unable to use Postgres HOT 5
- NameError: uninitialized constant SlackRubyBotServer::Api::Presenters::TeamPresenter::Boolean w/mongoid 7.3.x HOT 5
- Throws a Runtime Error if team is already regstered. HOT 6
- Add support for socket mode HOT 4
- Replace cursor_pagination HOT 12
- Add to Slack button - Redirect Endpoint? HOT 1
- What about this gem sets it up to show the Add To Slack button? HOT 3
- Document adding a RESTful API HOT 5
- Bot doesn't handle being removed from the last Organization on Slack side HOT 2
- Prevent test workflows from running when updating docs only HOT 1
- Release 2.1.0 HOT 1
- Disabling/Hiding some teams endpoints. HOT 4
- Configuring Log Level HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-ruby-bot-server.