Jeremy Bray

Joined

1,520 Experience
13 Lessons Completed
0 Questions Solved

Activity

Posted in Select Or Create Field With Selectize.js Discussion

for those of you loveing this but pulling your hair out as to why your modal will not close and you hit errors

$(document).on("turbolinks:load", function() {
    var selectizeCallback = null;

    $(".series-modal").on("hide.bs.modal", function(e) {
        if (selectizeCallback != null) {
            selectizeCallback();
            selectizeCallback = null;
        }

        $("#new_series").trigger("reset");
        var selectors = [$.rails.linkDisableSelector, $.rails.formEnableSelector].join(', ');
        $(selectors).each(function() {
            $.rails.enableElement(this);
        })
    });

    $("#new_series").on("submit", function(e) {
        e.preventDefault();
        $.ajax({
            method: "POST",
            url: $(this).attr("action"),
            data: $(this).serialize(),
            success: function(response) {
                selectizeCallback({value: response.id, text: response.name});
                $(".series-modal").modal('toggle');
            }
        });
    });

    $(".selectize").selectize({
        create: function(input, callback) {
            selectizeCallback = callback;

            $(".series-modal").modal();
            $("#series_name").val(input);
        }
    });
});

just change series-modal to your modal name and #new_series to your model name

Posted in Multitenancy with the Apartment gem Discussion

heyheyheyheychrisheyheyheyheychristryusingthecommentsystemfromamobile

Posted in How do I create a reply comment system?

hey chris tried to report the above posts as spam and got This gorails.com page can’t be foundNo web page was found for the web address: https://gorails.com/forum/how-do-i-create-a-reply-comment-system/forum_posts/11741/report

just an fyi

Posted in @mentions for Users with ActionText in Rails 6 Discussion

Hi @chris I have a little app that has a venue and user that I would like the user to be able to call something like " Hey @user do you want to go to #venue on saturday?" or the like.

is that possible?

Posted in How Do I Use Selectize in Rails 6

Hi there, I really love the selectize tutorial and would love to use it in a rails 6 application. What changes do I need to make to the tutorial.

can i just change

//= require selectize

to

$ yarn add selectize

Do I need to add Selectize to my environment.js like i would jquery

const webpack = require('webpack')
environment.plugins.prepend('Provide',
  new webpack.ProvidePlugin({
    $: 'jquery/src/jquery',
    jQuery: 'jquery/src/jquery',
        selectize: '?'
  })
)

And or Require selectize in application.js file.
require('selectize')

Posted in Why Wistia?

Hi Chirs an @sweeetland I am actualling doing exactly this, vimeo basically gives you embed code under the share button and just make sure you have set up your privacy settings to allow your domain to embed.

<iframe src="https://player.vimeo.com/video/<%= @video.vimeo_id %>" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>

Posted in Install Bootstrap with Webpack with Rails 6 Beta

Hi Guys, this is great. I came across a recent issue with webpacker not compiling and hence creating issues. This is the github discussion:

https://github.com/rails/webpacker/issues/2109

basically in your babel.config.js swap from corejs: 3 to corejs:false anywhere it appears.

this solved my frustration...

Posted in Rails Application Templates Discussion

Hi Chris,

when deploying to heroku I get the following error:

2018-11-05T20:24:11.935122+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gwfcm.herokuapp.com request_id=faaeeb99-5f62-4354-b05e-b5540d91f459 fwd="1.132.107.24" dyno= connect= service= status=503 bytes= protocol=http

Is this a sommon issue with jumpstart and heroku?

Posted in Best way to render a page as a PDF

This would be a great episode chris

Posted in API Authentication with an OAuth Provider Discussion

Uncommented and removed head :forbidden unless current_user.admin? as i do not have an admin role set up.

Posted in API Authentication with an OAuth Provider Discussion

Did you sort this out @geraldcarter

Posted in API Authentication with an OAuth Provider Discussion

Yeah I get that, I am just struggling to see where that happens in the video? As far as i can see I have my Doorkeeper set up as you have seems the comment above mine is the same?

Doorkeeper.configure do
  # Change the ORM that doorkeeper will use (needs plugins)
  orm :active_record

  resource_owner_authenticator do
      current_user || warden.authenticate!(:scope => :user)
  end

  # If you didn't skip applications controller from Doorkeeper routes in your application routes.rb
  # file then you need to declare this block in order to restrict access to the web interface for
  # adding oauth authorized applications. In other case it will return 403 Forbidden response
  # every time somebody will try to access the admin web interface.
  #
  # admin_authenticator do
  #   # Put your admin authentication logic here.
  #   # Example implementation:
  #
  # if current_user
  #  head :forbidden unless current_user.admin?
  #   else
  #     redirect_to sign_in_url
  #   end
  # end

I can see the commented out section, but this is commented out in the video...

Am I missing something?

Posted in API Authentication with an OAuth Provider Discussion

I am not sure what i am doing wrong but i keep hitting

Started GET "/oauth/applications" for 127.0.0.1 at 2018-09-13 14:37:44 +1000
Processing by Doorkeeper::ApplicationsController#index as HTML
Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.
Filter chain halted as :authenticate_admin! rendered or redirected
Completed 403 Forbidden in 2ms (ActiveRecord: 0.0ms)

Posted in API Authentication with an OAuth Provider Discussion

Thats awesome mate, is there a video where you show how to create that? I only asked because when I went to http://localhost:3000/oauth/applications i got a blank page

Posted in API Authentication with an OAuth Provider Discussion

Hi Chris is this video a follow on from something else, there seems to be a lot of code not outlined in the video. Just want to make sure I am starting at the start

Posted in Multitenancy with the Apartment gem Discussion

check this out 

https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain

Posted in Import a CSV with associations?

Hi Chris and Robert, this is awesome. This turned out to be the missing piece in my nested attribute journey

Posted in Multiple role based authorization

How did you go with this Bruno? I am just about to implement this on a little app I have

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.