Umar Ghouse

Joined

1,870 Experience
17 Lessons Completed
0 Questions Solved

Activity

Posted in How do I store audio files in production?

Thanks Chris!

Funnily enough, after posting this, I noticed your podcast on Transistor and told my friend about it, since that reduces the overhead for her to start her podcast - she's opted to go for using Transistor for now (and since transistor supports embeds, she felt it'll help her move her stuff to a custom website, if she ever wanted to, without much hassle).

But I'll keep this in mind if I ever make a podcast website in future. Thanks!

Posted in How do I store audio files in production?

Hey guys!

I'm working on building a Rails app for a friend of mine - this app will be for her to host episodes of her podcast. I've already decided to use something like SoundManager or Plyr to actually play the audio clips, but I'm not sure how to store the audio files.

  1. Should it be stored on the file system directly? If so, how do I do that on Heroku?
  2. Or is it better to store it in an S3 bucket and stream it to a player?
  3. Or should she opt for something like anchor.fm and I simply pull the audio data from the RSS feed that anchor.fm provides? Is that even possible?

Thanks in advance!

Posted in How to use ActionText in Rails 6 Discussion

You can set a min-height property for the trix editor, like so:

trix-editor {
  &.form-control {
    min-height: 400px;
    height: auto;
  }
}

I tested that in my dev environment and it works fine to ensure that the editor is taller on load and still expands with content being added.

Posted in How do I use easyautocomplete in rails 6?

I haven't done it exactly like that, but have it as below:

const { environment } = require('@rails/webpacker')

const webpack = require('webpack')
environment.plugins.append('Provide', new webpack.ProvidePlugin({
    $: 'jquery',
    jQuery: 'jquery',
    Popper: ['popper.js', 'default']
}))

module.exports = environment

Would that suffice? I should note that Bootstrap tooltips etc. all work just fine

Posted in How do I use easyautocomplete in rails 6?

@Christopher Did you ever manage to solve this? I've tried adding it and keep getting the TypeError you mentioned.

This is my application.js file:

require("@rails/ujs").start()
require("jquery/dist/jquery")
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("bootstrap/dist/js/bootstrap")
require("easy-autocomplete/dist/jquery.easy-autocomplete")

import LocalTime from "local-time"
LocalTime.start()

require("trix")
require("@rails/actiontext")

$(document).on('ready turbolinks:load', function () {
    bsCustomFileInput.init();
    $('[data-toggle="tooltip"]').tooltip();
})

and my aplication.scss :

@import "bootstrap/scss/bootstrap";
@import "easy-autocomplete/dist/easy-autocomplete";

Any idea what I'm missing?

Posted in How to use ActionText in Rails 6 Discussion

So, I'm trying to set up ActionText to create a WYSIWYG editor on my blog, but I'm running into a bit of a strange bug - I noticed that ActionText allows me to add any number of attachments when I make a Post or edit a post for the first time, thereafter any attachments I try to add on any posts are not saved until I restart the server (either by making changes to the code and saving or shutting down the server and re-starting it)

All I see is the new image with a "progress bar" - see screenshot below - and when I save the post, it does not save the new image. enter image description here

[![error image][(https://i.stack.imgur.com/bcV9F.png)]]

The output on the console looks like this the first time.

and like this the second time

I'm not sure what the issue is - any idea what I am missing?

Depending on how your database schema is set up, I'm not sure you'd need a gem to do it. I think, if you create a has_many, through: association between the artist model and the user model, that should be sufficient.

For example, if you create a new model called followers then you can add this line to the artist model:

class Artist < ApplicationRecord
    ...
    has_many :users, through: :followers
end

Similarly on the user model, you'd say:

class User < ApplicationRecord
    ...
    has_many :artists, through: :followers
end

Finally, on the followers model, all you say is:

class Follower < ApplicationRecord
    belongs_to :artist
    belongs_to :user
end

In this way, you can allow a user to 'follow' many artists and allow an artist to have many 'followers' - but unless the artist chooses to also follow a user, it will not happen. (If you want to dis-allow an artist from being able to follow a user, then that can probably be done by removing the 'follow' functionality for artists only within the views or something)

That was really helpful! Thanks guys!

One follow up question - when you say to sort out the communication between the front end and the back end, do you mean that we will be creating it essentially as 2 separate microservices (so to speak) and that we connect them through API calls?

For example, having worked only with Rails, I create both the front end (i.e. my view files) and the backend (models, controller etc.) in one place - thereby, I don't actually make any API calls to connect the two.
But, if I understand you correctly, you mean that if the front end is being handled by a different system (like React), then it must be connected using APIs?

Hi there!

I've been the only developer at my workplace for a while now and I've been coding in Rails, primarily. I don't have any formal qualifications in development, but I've been self-learning this stuff online over the last few years (thanks a bunch to Chris and GoRails for all the times I've come here to learn stuff!)

However, about 2 weeks ago, we hired our first JavaScript Developer - something we've been trying to do for a while. The reason we went for a JS developer, was that we needed someone more skilled in front-end development and the guy we hired is just perfect (he works primarily on the front-end and mostly with React).

The problem is, I've never worked with other developers on a project before and have no idea how to structure the work. He, in turn, has never worked with Rails projects before and is very unfamiliar with how he can contribute either. (More than oncewe've discussed moving to a purely JS development environment, but that would take time for me to learn JS better as well).

So, my question is, how do I structure the work flow and how can we work together?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.