Lance Williams

Joined

3,130 Experience
21 Lessons Completed
1 Question Solved

Activity

Thanks for the helpful insight. I'll definitely do some set up practice on a droplet to test everything out. Yeah, I was struggling with the systemd configuration file. This helps tremendously.

And Jack thanks for pointing out the reason maybe to just stick with sucker_punch. I'll test it all out and see what makes the most sense.

Shakycode, I'll definitely take a look at the God gem as well.

I was mainly just frustrated that I couldn't figure out the Sidekiq setup.

Thanks for all the pointers!

I have no trouble setting up redis but for some reason I can't get sidekiq to work. I can get sidekiq and redis to work locally on a mac using brew but not on a Digital Ocean Ubuntu 16.04 server.

I'm currently using sucker_punch for running transactional email jobs but I would love to figure out how to set up Redis and Sidekiq on a Digital Ocean Droplet.

Does anyone have any tips or resources you've used to set this up?

I'm trying to figure out if I should move some of the stripe payment processing and invoice lookups etc.. to background jobs. Any suggestions for a simple membership type site?

Here are a couple of resources using suckerpunch that I've read through.

https://www.masteringmodernpayments.com/blog/design-for-failure-processing-payments-with-a-background-worker

http://brandonhilkert.com/blog/using-the-sucker-punch-ruby-gem-to-cache-stripe-data-in-rails/

Thanks Chris! I'm liking the new features you've added to Go Rails.

Thanks Chris. Yeah I haven't worked that much with cookies even though they've been around forever. I'm currently working on using the Javascript approach which I think will be perfect for maintaining state for the search and checkboxes.

I've created a multi filter widget using a search_field_tag, and multiple check_box_tags and I can't seem to figure out how to maintain the checked checkboxes state throughout the session. So for instance if a user filters on several checkboxes and then visits a few other pages and returns to the search/filter page all of the filters previously selected are now blank.

I would like to show the filtered/checked state throughout the browser session and clear it out when the browser is closed.

I hope my question clear enough but if it isn't I can provide a better example.

I'm currently using javascript to go back one page i.e history.go(-1) and it keeps things correct if visiting a show page and then back to the search/filter page but I would really want things to be cleaner and maintained through out the session.

Any pointers would be greatly appreciated.

Thanks so much.

Posted in Protecting from XSS with Sanitize Discussion

Thanks Chris! I'm building an app and just realized I'm not sanitizing user generated urls. Thanks for the helpful tips.

Hi Chris,

Thanks for pointing me in the right direction. Once I put gem 'bundler', '~> 1.13', '>= 1.13.2' into my Gemfile and ran bundle update, pushed to github and then ran cap production deploy everything worked properly.

I didn't realize I specifically needed bundler in the Gemfile. I just thought based on the Gemfile.lock file that since it was using bundler 1.13.2 that production would use the same but I guess not.

Anyway, thanks for the help. Thanks for creating this amazing resource. Awesome work man!

It looks like someone else is experiencing the same issue. I still haven't been able to figure it out.

https://github.com/sparklemotion/nokogiri/issues/1541

Hi Chris,

In the Gemfile - gem 'nokogiri', '~> 1.6', '>= 1.6.8.1'
In the Gemfile.lock - nokogiri (1.6.8.1)

To get deployment to work again I had to revert back setting nokogiri and autoprefixer-rails back to the previous versions.
For nokogiri I now have it set to - gem 'nokogiri', '1.6.8' in the Gemfile and autoprefixer-rails set to gem 'autoprefixer-rails', '6.5.0.1'

Yeah I'm not sure why the Gems aren't being updated to the versions that match my Gemfile and Gemfile.lock from Github.

Is there anything you might try on production or locally to get things synced up again?

I've been using Capistrano to deploy my rails app and I've come across an issue trying to update 2 gems. Below at the bottom is the message I get for nokogiri. The other gem I'm trying to update on production is autoprefixer-rails. I basically get the same message when trying cap production deploy. On the production server I see under (/shared/bundle/ruby/2.3.0/gems) it says the version of nokogiri is 1.6.8 and locally I have 1.6.8.1.

The Gemfile and Gemfile.lock versions are correct on github and repo is fully up to date but when I do the cap production deploy I get this error that shows a mismatch between my development machine and the production server.

How do I go about updating these Gems on production? Everything has been working correctly up until the latest updates to autoprefixer and nokogiri.

fails at bundler:install --
Your bundle is locked to nokogiri (1.6.8.1), but that version could not be found
in any of the sources listed in your Gemfile. If you haven't changed sources,
that means the author of nokogiri (1.6.8.1) has removed it. You'll need to
update your bundle to a different version of nokogiri (1.6.8.1) that hasn't been
removed in order to install.

Posted in How to build REST APIs?

Awesome, can't wait!

Posted in Subscriptions with Stripe Discussion

In Rails 5 turbolinks was the issue. I needed to use $(document).on('turbolinks:load', function() {
Stripe.setPublishableKey( $('meta[name="stripe-key"]').attr('content') );
});
instead of the normal jquery ready function.

update: I did it the hard way. Chris already has a video on this: https://gorails.com/episodes/forms-with-multiple-submit-buttons?autoplay=1

I think I figured it out. I don't know if it's the best way but it seems to be working. I'm brand new to rails so I'm learning as I go. Thanks for the awesome content Chris.

In the UsersController in the update action I added:

if params[:commit] == "Update Profile"
  # logic for update profile form
end
if params[:commit] == "Update Password"
  # logic for update password form
end

In the edit.html.erb file the form submit button value name matched the params[:commit] comparison like this:

<%= form_for(@user, url: {action: "update"}, html: {id: "profile"}) do |f| %>
  # profile fields go here
  <%= f.submit "Update Profile" %>
<% end %>
<%= form_for(@user, url: {action: "update"}, html: {id: "password"}) do |f| %>
  # password fields go here
  <%= f.submit "Update Password" %>
<% end %>

in routes.rb I put this:

resource :user, only: [:edit, :update]

I've followed this link https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-password, but would like to just use the update action and not have to use update_password & update_profile custom actions.

Chris, on gorails.com on the settings page you have 'edit profile' and 'edit password' going to the default 'update action'. What kind of logic did you use to allow multiple forms submitting to the /users (update) action.

Thanks so much!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.