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
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
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/.