1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Last-Update: 2014-11-17
Forwarded: https://github.com/leonko/redmine_pretend/pull/9
Author: Dmitry Smirnov <onlyjob@member.fsf.org>
Description: replace deprecated method.
~~~~
An error occurred while loading the routes definition of redmine_pretend plugin (/usr/share/redmine/plugins/redmine_pretend/config/routes.rb):
You should not use the `match` method in your router without specifying an HTTP method.
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
Instead of: match "controller#action"
Do: get "controller#action".
Error when running rake db:migrate, check database configuration.
~~~~
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,8 +1,8 @@
if Rails::VERSION::MAJOR >= 3
RedmineApp::Application.routes.draw do
- match 'admin/pretend_to/:id' => 'application#pretend_to', :as => 'pretend_to'
- match 'admin/unpretend' => 'application#unpretend', :as => 'unpretend'
+ post 'admin/pretend_to/:id' => 'application#pretend_to', :as => 'pretend_to'
+ post 'admin/unpretend' => 'application#unpretend', :as => 'unpretend'
end
else
ActionController::Routing::Routes.draw do |map|
map.pretend_to 'admin/pretend_to/:id', :controller => 'application', :action => 'pretend_to'
--- a/app/views/user/_pretend_to.html.erb
+++ b/app/views/user/_pretend_to.html.erb
@@ -1,4 +1,4 @@
-<%= link_to l(:button_pretend), pretend_to_path(@user), :class => 'icon' if !session[:real_user_id] && User.current.admin? %>
+<%= link_to l(:button_pretend), pretend_to_path(@user), :class => 'icon', :method => :post if !session[:real_user_id] && User.current.admin? %>
--- a/app/views/user/_unpretend.html.erb
+++ b/app/views/user/_unpretend.html.erb
@@ -1,6 +1,6 @@
<% if session[:real_user_id] %>
<div class="flash error">
<%= l(:pretend_message) %> <%= User.find_by_id(User.active.find(session[:real_user_id])) %>
- <%= link_to l(:button_unpretend), unpretend_path, :class => 'icon' %>
+ <%= link_to l(:button_unpretend), unpretend_path, :class => 'icon', :method => :post %>
</div>
<% end %>
\ No newline at end of file
|