hi all when i m trying to save my tags.this error s cmng........cn anybody help me to how to save the array error depicting = undefined method `save'' for []:Array --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
it would be better if you showed some code about how this array gets created and used... generally - and assuming the array contains un-saved ActiceRecord Objects and not just params or something: @tags.map! {|t| t.save } On 21 Feb., 10:42, joe <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hi all > when i m trying to save my tags.this error s cmng........cn anybody > help me to how to save the array > > error depicting = undefined method `save'' for []:Array--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
actually i m gettng this error while using act as taggable on steriods plugin On Thu, Feb 21, 2008 at 3:19 PM, Thorsten <duplexxx-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > it would be better if you showed some code about how this array gets > created and used... > > generally - and assuming the array contains un-saved ActiceRecord > Objects and not just params or something: > > @tags.map! {|t| t.save } > > On 21 Feb., 10:42, joe <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > hi all > > when i m trying to save my tags.this error s cmng........cn anybody > > help me to how to save the array > > > > error depicting = undefined method `save'' for []:Array > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
def create @article = Article.new(params[:article]) @article=Article.find_tagged_with(params[:tag_list]) @article.save On Thu, Feb 21, 2008 at 3:27 PM, joe nayyar <joe.nayyar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> actually i m gettng this error while using act as taggable on steriods > plugin > > > On Thu, Feb 21, 2008 at 3:19 PM, Thorsten <duplexxx-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > it would be better if you showed some code about how this array gets > > created and used... > > > > generally - and assuming the array contains un-saved ActiceRecord > > Objects and not just params or something: > > > > @tags.map! {|t| t.save } > > > > On 21 Feb., 10:42, joe <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > hi all > > > when i m trying to save my tags.this error s cmng........cn anybody > > > help me to how to save the array > > > > > > error depicting = undefined method `save'' for []:Array > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
okay now it''s clear... Article.find_tagged_with(params[:tag_list]) will return an array of article objects (even if there is just one match in the database) Then you call save on this array. Which of course will not work. You are also overriding the new created @article with the ones retrieved from the DB ... why? or is this a typo and the articles you get from the DB should be @articleS ? Like, create a new article, and find related ones by tag to show them after the new article was created?!? def create @article = Article.new(params[:article]) @related_articles= Article.find_tagged_with(params[:tag_list]) @article.save end That should work, if you want that. On 21 Feb., 11:01, "joe nayyar" <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> def create > @article = Article.new(params[:article]) > @article=Article.find_tagged_with(params[:tag_list]) > @article.save > > > > On Thu, Feb 21, 2008 at 3:27 PM, joe nayyar <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > actually i m gettng this error while using act as taggable on steriods > > plugin > > > On Thu, Feb 21, 2008 at 3:19 PM, Thorsten <duple...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > it would be better if you showed some code about how this array gets > > > created and used... > > > > generally - and assuming the array contains un-saved ActiceRecord > > > Objects and not just params or something: > > > > @tags.map! {|t| t.save } > > > > On 21 Feb., 10:42, joe <joe.nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > hi all > > > > when i m trying to save my tags.this error s cmng........cn anybody > > > > help me to how to save the array > > > > > error depicting = undefined method `save'' for []:Array- Zitierten Text ausblenden - > > - Zitierten Text anzeigen ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---