Miguel

Joined

24,050 Experience
232 Lessons Completed
1 Question Solved

Activity

Posted in Actionable Errors in Rails 6 Discussion

This feature is sooo cool :D

Posted in Single Responsibility Principle Discussion

+1
Great episode Chris! This really makes me want to dive into more source code, I admit that I'm always hesitant to do it

Posted in Youtube text transcription

Yep, you just go to the video, hit "Settings" on the bar at the bottom, go to the "Subtitles/ CC" option. You should see a list of all the available options, and you just select "Add Subtitles/CC"

I've been following along the Forum series of episodes, when I try to submit a forum post, I get an error. It seems that the controller has trouble assigning the user id to the current user. I thought my associations were wrong, or had a typo but I tried to litteraly copy-paste Chris's code from the Github repo and nothing. What the hell is going on??

user model

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
  has_many :forum_threads
  has_many :forum_posts
end

forum threads model

class ForumThread < ActiveRecord::Base
  belongs_to :user
  has_many :forum_posts
  has_many :users, through: :forum_posts

  accepts_nested_attributes_for :forum_posts

  validates :subject, presence: true
  validates_associated :forum_posts
end

I also tried scratching the through: :forum_posts and the whole has_many :users, through: :forum_posts... nope

forum posts model

class ForumPost < ActiveRecord::Base
    belongs_to :user 
    belongs_to :forum_thread    
end

The part of the ForumThreadsController that seems to raise the problem

        def create 
        @forum_thread = current_user.forum_threads.new forum_thread_params
        @forum_thread.forum_posts.first.user_id = current_user.id

        if @forum_thread.save 
            redirect_to @forum_thread 
        else 
            render action: :new 
        end
    end 
        ```
[Here's the repo](http://github.com/mickeytgl/gorails_forum)

Posted in Styles not rendering

Thanks for the tip! Yeah, GoRails is pretty awesome and clear :)

Posted in Styles not rendering

Update:

The normalize and the font-awesome styles were being blocked since it was not being served in a secure protocol (https). Also, you're right Adrian, Proxima Nova is not in either (I don't know how the guy in the tutorial had no problem)

Posted in Styles not rendering

Hey guys,

So I'm following a tutorial, and around the 1 hr mark, he starts adding the styles. When I tried to reproduce it, it would not render.

When I inspect an element, for example (intro), it shows me these lines from the application.css.scss : (but it doesn't render it)

body {
    font-family: "Proxima Nova";
    font-weight: 100;
}

Also, there are more attributes added as @import to the application.css.scss that should be inherited to the element (and the browser actually successfully reads it, when I click to see the file), but it doesn't render any of that stuff either.

Where I think the problem is:
These 2 lines on my application.html? Somehow? But I don't know why or how. I went to the page and copied the current version, (The exact link differs a bit from the one of the tutorial, but I also tried the old one and no luck)

  <link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" rel="stylesheet"> 
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
What rookie mistake am I making??
[Here's my repo](https://github.com/mickeytgl/muse/tree/master/app/assets/stylesheets)

Cheers, Miguel
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.