Wednesday, February 15, 2012

[Rails] Re: check_box_tag

Hi Javier,

Following is the controller-action which I am using to delete the tags.
But the issue is with the 'tag_ids[]' array. The array will be always
nil. So i am unable to delete any of the tags.


def delete_tag
@delete_tags = params[:tag_ids]
if request.delete?
@delete_tags.each do |del|
Tag.destroy(del)
end
end
redirect_to :action => :index, :tab => 'tags'
end


When I click on the link, I am getting following error message:

NoMethodError in AdminController#delete_tag

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each


Thank you all

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate