Я хотел был бы отправить данные на update
action from new
действие с помощью кнопки. Поэтому, если пользователь нажимает кнопку отмены;Отправить данные с помощью кнопки с другого действия
<%= button_to "Cancel", {:controller => :requests,
:action => 'update', :user_id =>received.user.id, :id => received.id }, :value => "Cancelled" %>
The value has to be sent to the `update` action. But instead I receive an error;
Started POST "/user/295/requests/29" for ::1 at 2015-10-17 12:35:30 +0300
ActionController::RoutingError (No route matches [POST] "/boats/295/requests/29"):
и контроллер запроса;
def update
@request = Request.find(params[:id])
puts situation = params[:situation]
if @request.update_attributes(situation)
flash[:success] = "Approved"
redirect_to new_user_request(current_user.id)
else
redirect_to new_user_request(current_user.id)
end
В принципе, хотелось бы отправить текстовые данные для обновления действия в контроллере запросов.
Хорошо, спасибо, уточнение. –