To access the month parameter:

params[:month]

You don't need to add the month as an argument to the method.

def destroyMonth(month)

should be def destroyMonth

and if you are following ruby style the method should be written in
camel_case

def destroy_month

Cheers,
Nicholas


On Aug 22, 12:05 pm, Soller Prieto <[email protected]>
wrote:
> I have this in my view List:
>
> <p><label> Delete all user have more than (month): </label>
> <%= text_field_tag("month", p, :size => 10 ) %>
> <%= link_to 'Delete', :confirm => 'Are you sure?',:month => p,:action =>
> "destroyMonth"%></p>
>
> and in the controller i have the method destroyMonth
>
>   def destroyMonth (month)
>     now= Time.now
>     puts now.months_ago(month)
>     puts now.to_s(:db)
>     @user = User.find(:all, :conditions => ["updated_at < ?",now])
>     for e in @user
>       e.destroy
>     end
>     redirect_to :action => 'list'
>   end
>
> How can I at the parameter in the method???
>
> Thank you!!
> --
> Posted viahttp://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 [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