dasibre
2013-Jun-14 13:23 UTC
Michael Hartl rails tutorial twitter @replies feature extension
Hi, I completed the Michael Hartl tutorial, and i''m trying to add the twitter like @replies feature to the app but I''m completely lost. Here is what I have so far. I added the in_reply_to column to the Micropost Model and created a User, has_many through microposts relationship. I''m lost after that. Any assistance will be greatly appreciated. User Model has_many :microposts, dependent: :destroy has_many :replies, through: :microposts, source: :in_reply_to Micropost Model class Micropost < ActiveRecord::Base attr_accessible :content belongs_to :user belongs_to :in_reply_to, class_name: "User" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3993a718-cd8e-4474-b41e-1b9d0e4f76d1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Matt Jones
2013-Jun-15 20:10 UTC
Re: Michael Hartl rails tutorial twitter @replies feature extension
On Friday, 14 June 2013 06:23:32 UTC-7, dasibre wrote:> > Hi, > I completed the Michael Hartl tutorial, and i''m trying to add the twitter > like @replies feature to the app but I''m completely lost. Here is what I > have so far. > > I added the in_reply_to column to the Micropost Model and created a User, > has_many through microposts relationship. I''m lost after that. Any > assistance will be greatly appreciated. > > User Model > > has_many :microposts, dependent: :destroy > has_many :replies, through: :microposts, source: :in_reply_to > > Micropost Model > > class Micropost < ActiveRecord::Base > > attr_accessible :content > belongs_to :user > belongs_to :in_reply_to, class_name: "User" > >Here''s a hint: how should in_reply_to get a value? Perhaps you could set it based on scanning the text of the micropost about to be created? --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9e62415c-ff29-4912-b465-a55341c4d3c8%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
dasibre
2013-Jun-16 02:37 UTC
Re: Michael Hartl rails tutorial twitter @replies feature extension
On Saturday, June 15, 2013 4:10:52 PM UTC-4, Matt Jones wrote:> > > > On Friday, 14 June 2013 06:23:32 UTC-7, dasibre wrote: >> >> Hi, >> I completed the Michael Hartl tutorial, and i''m trying to add the twitter >> like @replies feature to the app but I''m completely lost. Here is what I >> have so far. >> >> I added the in_reply_to column to the Micropost Model and created a User, >> has_many through microposts relationship. I''m lost after that. Any >> assistance will be greatly appreciated. >> >> User Model >> >> has_many :microposts, dependent: :destroy >> has_many :replies, through: :microposts, source: :in_reply_to >> >> Micropost Model >> >> class Micropost < ActiveRecord::Base >> >> attr_accessible :content >> belongs_to :user >> belongs_to :in_reply_to, class_name: "User" >> >> > Here''s a hint: how should in_reply_to get a value? Perhaps you could set > it based on scanning the text of the micropost about to be created? > > --Matt Jones >Thanks for the hint, i think thats one of the things i couldn''t figure out. It was a trial and error to get this far. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ebcd5406-c3a1-48cb-ad3b-0e3108fec995%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.