Skip to main content

Subscribe to GoRails to get access to this episode and all other pro episodes, and new awesome content every month.

Subscribe Now
Only $19/month

Unlimited access. Cancel anytime.

9 Nested Comment Threads in Rails:

Nested Comment Threads in Rails - Part 1

Episode 262 · September 12, 2018

How to build nested comments and threads in Ruby on Rails

ActiveRecord Views Comments


Transcripts

No transcripts available. Earn a free month

Discussion


Fallback

Greate episode! If I should get this episode a couple of years ago, that may should saved my life jajaja!

So, this is the same logic you are using here in your post and epdisode comments?

Fallback

Yep, pretty much.

Fallback

Awesome! Thanks for sharing Chris!


Fallback

Woohoo, thanks for doing this!


Fallback

Thanks Chris! . This is great!


Fallback

For some reason...you often create episodes just fitting in my current needs..thanks.


Fallback

Chris as part of the next part2 series, please add the ability to dynamically update without refreshing the page.... Best practice. As i am able to use the reply system, but i hate how the page has to refresh and i have been struggling to have it appear directly on the page without refreshing... That will be helpful!!

Fallback

any help on this topic will be helpful

Fallback

I can cover that in a follow-up episode. 👍


Fallback

Thank you chris for the consideration!!! that why i re-joined:) when you cather to all your user needs, you build a loyal group of people... Thank i am looking forward for the episode... you know when that will be? :) excited!!!


Fallback

hi chris,

using the rails generate command below:
rails g model Comment user:references commentable:references{ploymorphic}:index parent_id:integer body:text

created the migration file:
class CreateComments < ActiveRecord::Migration[5.2]
def change
create_table :comments do |t|
t.references :user, foreign_key: true
t.references :commentable, ploymorphic: true, foreign_key: true
t.integer :parent_id
t.text :body

  t.timestamps
end

end
end

which failed " PG::UndefinedTable: ERROR: relation "commentables" does not exist "

i went through the github files and found that your migration file did not have the foreign_key: true on the commentable line. i reran the migration and it worked, but just out of curiosity why did the references create a foreign_key: true for my migration and not your migration.

cheers

gus

Fallback

It looks like you spelled polymorphic wrong which might be why it threw that error.

Fallback

bugger! typing on the train LOL! thanks


Fallback

chris can we also cover auto scrolling when comment meets at end of page, if it has more comments that it will load as user scrolls? maybe on the main page or do it on a pop up when a user clocks view more comments it pops up and then they can see all the comments and as they reach bottom if there is more comment it scrolls?


Login or create an account to join the conversation.