Conection

I have this in my view List:

Delete all user have more than (month): <%= text_field_tag("month", p, :size => 10 ) %> <%= link_to 'Delete', :confirm => 'Are you sure?',:month => p,:action => "destroyMonth"%>

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!!

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 P. [email protected]

oohh thank you!! I solved!!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs