def delete_homework
Homework.all(:conditions => {:teacher => params.require(:teacher) })
redirect_to :back
end
This is my controller
<div class="row">
<div class="col s12">
<div class="card blue-grey lighten-2">
<div class="card-content white-text">
<span class="card-title">Delete Homework</span>
<form action="/welcome/delete_homework">
<input type="text" name="teacher" placeholder="Teacher Name">
<input class="btn waves-effect waves-light" type="submit">
</form>
</div>
</div>
</div>
</div>
This is the HTML side.
When I try this, ruby gives ArgumentError in WelcomeController#delete_homework wrong number of arguments (given 1, expected 0)
what's wrong? please help. Thank you in advance
delete_homeworkaction?all(:conditions =>...)syntax was used in Rails up to version2.3and doesn't work anymore in newer versions. Whatever book oder tutorial you found with a code example with that syntax - it is outdated for at least 5 years...Rails.application.routes.draw do get 'welcome/index_array' get 'welcome/index_hash' get 'welcome/index_db' get 'welcome/create_homework' get 'welcome/delete_homework' get 'welcome/index_manage'