Jacob Hedengren

Joined

450 Experience
1 Lesson Completed
0 Questions Solved

Activity

Hey everyone,

I'm using a Railsbytes script to install bootstrap 5 alpha; https://railsbytes.com/public/templates/VB0s5v.

However, I can't get any of the tooltips and popovers to work. Not sure even where I should put the scripts or if I have to add anything to it in order to enable them. Would anyone please be so kind and provide some guidance. Thanks a lot!

Example

var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})

/ Jacob

Posted in API

Thanks John! Worked perfectly!

Posted in API

Hi everyone,

I have recently set on a mission to learn more about APIs. I get some data from a external JSON API but have come a cross an issue that I need some help with.

I’ve defined my cars variable in my controller and set it to

def index 
    @cars = HTTParty.get('...
end

I am then looping through each car in my view with

<% @cars.each do |car| %>
    <%= car[“date”] %>
<% end %>

The result in my view;

2018-07-13T00:27:03-07:00

How can I change this format to instead say time_ago_in_words?

Thanks alot in advance!

/ Jacob

Posted in Devise Secret Key was not set automatically

Thanks Chris!

So 

config.secret_key = Rails.application.credentials.secret_key_base

is what I put in my devise initializer and thats it?

How do I put my RAILS_MASTER_KEY env variable in as well? Do I put 

config.require_master_key = ?

in my devise initializer as well or set it to true in my production.rb?

Thanks a lot for the help, I appreciate that!

Posted in Devise Secret Key was not set automatically

Hi everyone,

Strange problem appeared today. I am using Ruby 2.5.1 and Rails 2.5.0.rc2. When installing devise and pushing to heroku I got an error saying that the devise secret key was not set even tough the devise installation and db:migrate succeeded. I then had to check my build logs to find the key and manually add it to my devise initializer. Whats the reason causing this problem? Is it safe to have my secret key in the initializer? Some way to avoid this in the future?

Thanks a lot in advance!

/ Jacob

Posted in Condition if devise action view

Thank you so much Chris and Jacob! Problem solved! 

Posted in Condition if devise action view

Hi everyone,

I am struggeling with finding out how to add a condition to hide my navbar partial if user is currently in one of the devise views. For example if user is currently in devise sessions new, I would like to hide my navbar partial. How would I accomplish this?

/ Jacob
Thanks a lot for making this more clear to me Chris! I appreciate that!
Hi everyone,

I am a bit confused; whether I am using Rails 5.1.4 or upgrading to 5.2.0.rc1 (Ruby version is 2.5.0) a lot of new files have all of a sudden appeared in my apps and I am unsure of the impact they have on my application.

First of all there are hundreds of strange files created in subfolders under temp/cache/bootsnap-compile-cache. They all appear to just contain strange characters and I don't really understand the purpose of the files being created or why they all of a sudden appears after 1 year creating many apps.

log/development.log, tmp/cache/, tmp/restart.txt are all new files/folders appearing all of a sudden. Can someone please explain what the reason for this might be?

Thanks a lot in advance!

/ Jacob

Posted in Stripe EU Vat

Thanks for your reply Chris and the link! I'll have to investigate this further. It has certainly made it a lot more difficult to sell digital products and services within the eu.

Posted in Stripe EU Vat

Hi!

Thank you Chris for your great videos. I live in Sweden and I'm trying to set up a stripe monthly subscription on my site and need to collect the correct vat from my users which I'm required by law to do.

So the taxation take place in the country where the purchaser resides. Therefore I have to find out where my customers live, add the correct vat, and after that charge them the correct amount. How would I solve this? Any ideas?

Thanks a lot in advance!

/Jacob