Activity
Posted in Custom Validations Issue
Hey Thomas,
The main issue here is your default_site method I believe. Here's the problem:
Your default_site method issues a database query.
When your form submits, you actually are modifying the record (and nested records) in memory. When your validation runs, it needs to check against the in-memory nested records that you're submitting, not the ones in the database.
class UserValidator < ActiveModel::Validator
def validate(record)
if record.sites.count < 1
record.errors.add(:site, "must have at least one site available")
end
if record.sites_users.select{ |su| su.is_default }.count != 1
record.errors.add(:site, "must have exactly one site selected as default")
end
end
end
Changing it to this will do a check against the sites_users in-memory. You can leave your database query for default site as it does some extra loading for performance elsewhere I'm assuming.
Posted in Bundle Package and Deployment
Hey Philip,
Capistrano just runs bundle
on the server. You can see it in the logs.
Gems can be installed in different folders, and Capistrano will cache the gems in a shared bundle folder in your repo's folder on the server. It can also load gems from outside that like the vendor folder or gems installed on the user or system level.
For some reason, I'm getting the same issue with Capistrano. If I add a new gem, it'll run the bundle command but it won't be installed on the server. I don't know why that is. It's caused GoRails to crash a couple times because of that.
We probably need to poke around the issues on Github to see if there's anyone else mentioning the issue: https://github.com/capistrano/bundler.
Also on the server, your gems won't necessarily be in your PATH, so you may have to run bundle exec rails c
to run the Rails console.
I'd just throw some console.log
s into your JS and see what's getting called and what's not. Then you can figure out what you are missing.
Hey Sebastian,
Your error is:
/home/deploy/apps/Blogapp/shared/bundle/ruby/2.5.0/bin/rake: No such file or directory - java
So maybe you have a dependency that needs Java installed. It looks like it's required for Yui compressor.
Make sure Java is installed on your server.
It looks like you spelled polymorphic wrong which might be why it threw that error.
Yep, I'm working on a whole new version. Also going to include a shopping cart example!
I've been waiting a little bit to make sure that I cover any new API changes that they are making. I'm going to start recording the new version this week so it should be out shortly.
If only APIs didn't change... 😜
If I remember right, you call sign_in
instead of success!
.
I can cover that in a follow-up episode. 👍
@jacob 👍
That would make sense since you use ORDER to sort in SQL.
I guess you could modify the code to be the following to specify the column and clarify it for the db that you're not using the ORDER keyword.
Lesson.where("lessons.order < ?" , 8)
I'd much rather rename the column though.
Depends on what you know more. React Native let's you build with React, HTML, and CSS for any native features. Turbolinks will require you to write a lot of Swift or Java to do anything native.
Just gonna drop this here. I built a series using Rails and React Native iOS. https://gorails.com/series/oauth-api-authentication
Check the 3rd line there:
Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.
That route comes from the doorkeeper gem, so if it's blank, then your installation may not be done right.
This is the episode on the Rails template: https://gorails.com/episodes/rails-application-templates
Hey Jeremy,
Like I mentioned at the beginning, we're using the Jumpstart template that I made. https://github.com/excid3/jumpstart
I'm not gonna waste your time installing Devise and Bootstrap every episode, so I made the Rails Jumpstart template for that. 👍
Yep, pretty much.
Posted in Repost / Retweet / Reblog Discussion
Retweets is simply a count the number of associated tweets.
@tweet.tweets.count
Posted in In-App Navbar Notifications Discussion
No, it says you tried to call the "post" method on a Post object. It's not a Comment, it's a Post.
Posted in In-App Navbar Notifications Discussion
If it works commented out, then you're probably throwing an error on that line. Read the logs to debug it. :)
Posted in RAILS SIDEKIQ SCHEDULER
I would suggest creating a worker that checks the status, and if the status is not completed, it schedules a copy of itself to run 5.seconds.from_now
. That way it can continuously keep checking and spawning new workers as needed until it's complete, or you've hit a timeout length or something.
Don't know when it's automatic, but yes it is a % payout for life (of the subscription).