Activity
Posted in Better Errors ignore 404 errors
Yeah, not much better way to test it that I know of unfortunately. As long as you're throwing that exception, you shouldn't have any problems.
Posted in Better Errors ignore 404 errors
I think it's always going to thrown an exception in development because that's internal to Rails. You can navigate to /404
to see your 404 page and Rails will catch any ActionController::RoutingError
or ActiveRecord::RecordNotFound
and render the 404 when in production mode.
I guess you could either run in production mode locally (the real true test) or you could rescue_from those exceptions. Something like so:
rescue_from ActiveRecord::RecordNotFound, :with => :rescue404
rescue_from ActionController::RoutingError, :with => :rescue404
def test_404
render file: 'public/404.html', status: :not_found, layout: false
end
I forgot that changed recently, great reminder. Thanks for sharing that!
Posted in Setup MacOS 10.11 El Capitan Discussion
If your error was like his, it is showing that the "source" line also got copied into the file, so the ending single quote didn't get applied right most likely to close the string. Not having an ending semicolon is fine (just tested it again). Sometimes when pasting stuff into terminal there are weird things that cut off lines short or your browser can mess with quotes and make them curly when they should be straight (http://practicaltypography.... That shouldn't happen in a code block though. I can't reproduce the issue you guys are having with Chrome and both iTerm and Terminal so not entirely sure what's wrong for you guys, but it's one of these things.
Posted in Subscriptions with Stripe Discussion
Likely some configuration issue. I'm not entirely sure what causes that, but it's definitely fine to run on localhost. Probably like this guy where you've got a mistake somewhere causing their JS to run incorrectly: http://stackoverflow.com/a/...
Posted in Setup MacOS 10.11 El Capitan Discussion
You should just copy and paste each line into your terminal and run each one. Make sure that your copy/paste didn't mess up the command during the paste. I'm not sure what's causing you guys to get malformed commands.
Posted in Setup MacOS 10.11 El Capitan Discussion
Your ~/.bash_profile should just have one line that is that same as what's in the single quotes on that first line.
if which rbenv > /dev/null; then eval "$(rbenv init -)"
Looks like he had accidentally combined those two commands to run on accident.
Pretty simple. You'd need to basically listen for the subscription cancellation webhook to come across and then in there you can just move the user's plan over. The webhook will be your way of knowing that the last payment attempt failed and the user's paid subscription canceled. It'll just send a notification to your server and as long as you're listening for it, you can run the code to downgrade to the free plan. Make sense?
Check out this episode on the webhook stuff if you haven't already: https://gorails.com/episode...
Always happy to help. :)
Hey Lauro,
link_to
requires two parameters, first the name, second the URL you want to point to. You've only passed in the name, so it's not going to link correctly for you. Try passing in a second parameter to get that working:
<h3> <%= link_to like.post.title, like.post %></h3>
Posted in Solving FizzBuzz in Ruby Discussion
You can do str += n.to_s if str.empty? instead because it's an integer and needs to be converted to a string before you can add those together.
Posted in In-App Navbar Notifications - GoRails
I would just create one notification record for each user you want to send it to. You need to do that anyways so you can mark when each user read their notification if you want to add that feature in the future. So normally you would just do a loop, find all the users you want to notify, and then create a Notification record for each user.
Posted in How ActionCable Uses Redis Discussion
Yeah that's going to be an interesting one. Presumably you'll end up needing to build a cluster of dedicated actioncable servers and maybe you connect 100 users to each at a maximum. At some point as well, you'll probably run into Redis pubsub scaling problems, but that hopefully isn't a bottleneck right away.
Posted in Solving FizzBuzz in Ruby Discussion
Oh you know what, I probably had access to ActiveSupport while I was doing that.
Add this line at the beginning if you have the active_support gem installed.
require 'active_support/core_ext'
The blank? method doesn't come from Ruby but most of my work being in Rails I'm so used to having it around. :)
Posted in In-App Navbar Notifications - GoRails
I'm not sure, but compare your code against the source code of mine that's linked in the episode notes. I'm sure you'll figure it out! :)
Posted in In-App Navbar Notifications - GoRails
No, you don't need to because it will check for the action's json.jbuilder template. Just make sure you created that file and it's index.json.jbuilder in the app/views/notifications folder.
I've been realizing I need to make that transition soon anyways just because there are way too many screencasts to keep track of at this point. :)
I'll probably be migrating to a bunch of small series over the next few weeks!
👍🎉
Awesome! You're welcome! :D
Hmm, I was hoping it wasn't. Usually it's just that the user isn't signed in. Otherwise...I'm not entirely sure. There aren't a whole lot of places to go check to make sure things are correct aside from that.
Possibly just a typo in your comment, but make sure you've got:
@comment.user_id = current_user.id
If you specify user_id, then you need to specify ID on the user, or you can just assign the object to the association alternatively:
@comment.user = current_user