I can't update field in database table. Why, when I working in edit template(controller/id/edit), rails redirect me to CREATE action and create a new row in table? It must redirect me to update action and update only one field. Controller:
def create
Question.create(:user_id => session[:user_id], :question => params[:question][:question])
end
def update
debugger #not go there
@update = Question.find(params[:id])
@update.update_attributes(params[:question_status])
end
edit template
= form_for Question.new do |w|
%p
= w.label :question_status, :caption => "question status: "
= w.text_field :question_status
%p
= w.submit "Update"
routs.rb
match "questions/logout" => "questions#logout"
match "questions/show_all_questions" => "questions#show_all_questions"
match "questions/update" => "questions#update"
resources :questions
get "questions/create"
get "questions/show"
get "questions/update"
get "questions/destroy"
get "questions/new"
get "questions/edit"
get "questions/index"