Hi All, I am trying to implement a status update to be used on my web application. The tutorial I had followed suggested to do the following: Create a model called post with message:text Then rake db:migrate (so far so good – db shows new table ‘posts’) I then need to create a controller called post Within this there is then an index and create methods I add the relevant view information to the views/posts directory and all works fine. The problem I have is, I really want this within my existing user profile page (where a user would update their account) To alter this, is it just a case of adding the methods to the user_controller, and subsequent view files to the user’s view directory? As it stands, I can get the view to display nicely in the user’s profile/update area, but when I hit post, I’m taken to localhost/posts – which doesn''t look too great. What I need is for this to remain in the user profile area. Any ideas?
I''m not sure what you are trying to do here. When you say status update, I assume you are talking about a twitter-like status as opposed to system-wide status. You should keep the status related operations in the status controller. For example, if you wanted to add a status from the user view, you can have the form on the show user page, and have the form post to the post_controller, then redirect back to the user show. Better yet, you can make it an AJAX call. In sort, keep the controller, but you can probably ditch the views (or move the code to the user views). Darian Shimy -- http:/www.darianshimy.com http://twitter.com/dshimy On Mon, Nov 16, 2009 at 5:38 AM, RubyonRails_newbie < craigwesty79-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Hi All, > > I am trying to implement a status update to be used on my web > application. > > The tutorial I had followed suggested to do the following: > > Create a model called post with message:text > Then rake db:migrate (so far so good – db shows new table ‘posts’) > > I then need to create a controller called post > > Within this there is then an index and create methods > > I add the relevant view information to the views/posts directory and > all works fine. > > The problem I have is, I really want this within my existing user > profile page (where a user would update their account) > > To alter this, is it just a case of adding the methods to the > user_controller, and subsequent view files to the user’s view > directory? > > As it stands, I can get the view to display nicely in the user’s > profile/update area, but when I hit post, I’m taken to localhost/posts > – which doesn''t look too great. What I need is for this to remain in > the user profile area. > > Any ideas? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Cool - cheers... I''ll try it that way. On 16 Nov, 17:08, Darian Shimy <dsh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m not sure what you are trying to do here. When you say status update, I > assume you are talking about a twitter-like status as opposed to system-wide > status. You should keep the status related operations in the status > controller. For example, if you wanted to add a status from the user view, > you can have the form on the show user page, and have the form post to the > post_controller, then redirect back to the user show. Better yet, you can > make it an AJAX call. > > In sort, keep the controller, but you can probably ditch the views (or move > the code to the user views). > > Darian Shimy > -- > http:/www.darianshimy.comhttp://twitter.com/dshimy > > On Mon, Nov 16, 2009 at 5:38 AM, RubyonRails_newbie < > > > > craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > Hi All, > > > I am trying to implement a status update to be used on my web > > application. > > > The tutorial I had followed suggested to do the following: > > > Create a model called post with message:text > > Then rake db:migrate (so far so good – db shows new table ‘posts’) > > > I then need to create a controller called post > > > Within this there is then an index and create methods > > > I add the relevant view information to the views/posts directory and > > all works fine. > > > The problem I have is, I really want this within my existing user > > profile page (where a user would update their account) > > > To alter this, is it just a case of adding the methods to the > > user_controller, and subsequent view files to the user’s view > > directory? > > > As it stands, I can get the view to display nicely in the user’s > > profile/update area, but when I hit post, I’m taken to localhost/posts > > – which doesn''t look too great. What I need is for this to remain in > > the user profile area. > > > Any ideas?