On Feb 15, 2012, at 11:02 PM, Javier Quarite wrote:

> 
> 
> On Wed, Feb 15, 2012 at 11:00 PM, Ajit Teli <[email protected]> wrote:
> 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
> 
> 
> What is the code for the link?

And what do your checkboxes look like in your view? The name you give them will 
determine how they show up in your params hash. And the form tag you enclose 
them in will determine whether they even make it to the controller at all.

Walter

>  
> 
> -- 
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to