-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
ForumPost acts_as_votable #22
Comments
Yeah, totally. Should just add the gem to your model and customize the views for it. You'll probably need to build your own links and controller action for the votes up and down, but shouldn't be too hard. |
Right. I've customized views and controllers already. (BTW, thanks for this great gem. It's really intuitive and super simple to customize). I guess (lack of Rails fluency showing here) I'm not sure exactly what you mean by "Should just add the gem to your model". Are you saying I create my own model that wraps the same table as the SimpleDiscussion ForumPost model does? Or is there a way to just create an extension to that class and add the acts_as_votable to it? |
You'll need to re-open the ForumPost class from the gem so that you can add acts_as_votable to it. The easiest way is probably to add an initializer and define your code there. I think something like this should reopen the class safely.
|
So I think you intended for that file path to be I tried it in the intializers directory and I get:
when I attempt to run the rails server. This is rails 6, so I may be running into something specific to my configuration. (I made sure acts_as_votable is in the Gemfile and successfully bundle installed. I also successfully ran its migration) Not sure. Any ideas? |
Yes, and you probably have to inherit from ApplicationRecord then if you're getting that error. # config/initializers/simple_discussion.rb
class ForumPost < ApplicationRecord
acts_as_votable
end |
@excid3 I know this is an old one - I am actually on the same boat as this original thread. So I wont to make
Is there a way to load all the gems before |
This may be a rails question more than simple discussion (again, sorry), but is it possible to add something like acts_as_votable to the ForumPost model from within my rails apps rather than within simple_disucssion itself?
The text was updated successfully, but these errors were encountered: