Activity
Posted in Is Something Wrong With Jumpstart?
What do the logs say?
You can add a position:integer
to your AuthorArticle model to keep track of the order.
The acts_as_list
gem can help you order them, but that wouldn't allow for duplicates where you might have several "lead authors". You can probably do without it.
The modal would be for an AuthorArticle object and would have two fields for author and position.
Posted in Huge syslog file in production
Awesome. You can use the RAILS_LOG_TO_STDOUT env var to have Rails not write to the normal log file. You may also need to tweak the ActiveRecord logger if you need to turn it off.
Posted in Huge syslog file in production
If you're running Puma with systemd or something, it will write to syslog by default. That will need to be logrotated more often so it doesn't fill the disk.
The logrotate location for syslog is /etc/logrotate.d/rsyslog
and you can add a line in there for setting a max file size. maxsize 500M
to rotate it after it becomes 500MB. You can also tweak how often the syslog is rotated as well.
You can also use lograge or a similar tweak to the Rails logs to minimize what they write.
Posted in Mailboxer Gem
I think I've seen any new gems for messaging since Mailboxer.
What parts of it doesn't work in Rails 6?
Rails UJS still makes this work exactly the same as it always has. There's really no need for Stimulus for this.
Posted in New website design!
TailwindUI does have the Alpine JS examples on the site if you inspect the page I believe. And I agree, will definitely add this to my list of episode ideas!
In the repo
Of course, just add your own delivery method for it.
Posted in Reopen ActionCable after login?
You can also call consumer.connection.open()
anytime to connect.
Posted in Reopen ActionCable after login?
So, just tested this as I added multitenancy to ActionCable in Jumpstart Pro. I confirmed that ActionCable will attempt to connect automatically after you login because of the NotificationsChannel we added.
Posted in Mail Password hacked
Look at what processes are running on your server. They could have installed some software that runs on the server to send the emails out and if so you'd need to remove that.
In your mailer you have:
mail(to: @post.recipient, subject: "My subject")
That should be
mail(to: params[:recipient], subject: "My subject")
👍
To run staging on your server, make sure you have RAILS_ENV=staging set in the env vars. 👍
You'd define it in config/routes.rb
root to: "controller#action"
In development, Rails will show the "welcome to Rails" screen, but in production that disappears and would 404 without a root
route.
The Rails root path is what will be rendered first. If that isn't found, it'll fall back and look for index.html in the public folder. Normally you have a Rails root so the index.html would never be used.
Posted in How do I add ranges to my application?
Not off the top of my head, but I can make a screencast on it. 👍
Posted in How do I add ranges to my application?
You can either:
- Make a select that submits "1-10" to a virtual attribute on your model and use Ruby to split on "-" to get minimum and maximum and assign those.
- Use Javascript to take the select value and fill out hidden fields for minimum and maximum on the Select change event.
I typically use the second approach so I can keep the backend cleaner.
Posted in How do I add ranges to my application?
Hey Sam!
Databases don't understand Ranges like Ruby does, so instead you can add the minimum and maximum values of the range to the database and construct the range from that.
t.integer :minimum
t.integer :maximum
class PricingClassification
def range
return nil unless minimum?
(minimum..maximum)
end
end
They test Jumpstart's functionality. You're free to recreate them in rspec too.
If you want everything that's built with your favorite tools, Jumpstart Pro is not the template for you. Jumpstart Pro is built using everything that comes with Rails and as few dependencies as possible to keep it clean and organized.