Project

General

Profile

Solved: Redmine 2.0: routes.rb synthax has changed?

Added by Anonymous over 12 years ago

Hello

I have spent quite some time searching for a way to change the default start page in Redmine 2.0.

Unfortunately it seems that the Synthax in that file has Changed. If I edit the file like this it spits out an error... (I added the "map.home .." line):

Config.rb:

..
RedmineApp::Application.routes.draw do
  map.home '', :controller => 'my', :action => 'page'

  root :to => 'welcome#index', :as => 'home'

  match 'login', :to => 'account#login', :as => 'signin'
  match 'logout', :to => 'account#logout', :as => 'signout'
..

Error:

undefined local variable or method `map' for #<ActionDispatch::Routing::Mapper:0x9f29320>

When we have found a solution it would be useful to document it in the Redmine Wiki. As i have seen, there are already users asking the same question in some of the other "Set default page/automatic redirect" threads.

I appreciate any help and comments.

Best regards
Andreas


Replies (11)

RE: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

Hello,

i got it working that way, start page is my page, but afterwards, it does not find the subpage. i'am still trying.

root :to => 'my#page', :as => 'home'

Solution: Redmine 2.0: routes.rb synthax has changed? - Added by Anonymous over 12 years ago

It's easy once you know :)

With this change in routes.rb the user gets redirected to the issues overwiev (/issues) for
all Projects:

root :to => 'issues#index', :as => 'home'

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

nice, but this the followinf error.

Started GET "/redmine/" for 192.9.133.16 at Thu Jul 12 09:27:21 +0200 2012
Processing by IssuesController#index as */*
  Rendered queries/_filters.html.erb (119.1ms)
  Rendered queries/_columns.html.erb (2.0ms)
  Rendered issues/_list.html.erb (42.0ms)
  Rendered issues/_sidebar.html.erb (17.6ms)
  Rendered issues/index.html.erb within layouts/base (195.3ms)
Completed 200 OK in 469ms (Views: 268.6ms | ActiveRecord: 44.9ms)

Started GET "/redmine/issues/247" for 192.9.133.16 at Thu Jul 12 09:27:36 +0200 2012
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"247"}
DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => 'Text' }' instead. (called from _app_views_issues__action_menu_html_erb___88352655_102409380 at C:/Program Files/BitNami Redmine Stack/apps/redmine/htdocs/app/views/issues/_action_menu.html.erb:6)
  Rendered issues/_action_menu.html.erb (23.4ms)
  Rendered issue_relations/_form.html.erb (2.9ms)
  Rendered issues/_relations.html.erb (19.5ms)
  Rendered issues/_history.html.erb (30.3ms)
DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => 'Text' }' instead. (called from _app_views_issues__action_menu_html_erb___88352655_102409380 at C:/Program Files/BitNami Redmine Stack/apps/redmine/htdocs/app/views/issues/_action_menu.html.erb:6)
  Rendered issues/_action_menu.html.erb (6.8ms)
  Rendered issues/_form_custom_fields.html.erb (1.0ms)
  Rendered issues/_attributes.html.erb (76.2ms)
  Rendered issues/_form.html.erb (247.1ms)
  Rendered plugins/redmine_inline_attach_screenshot/app/views/attachments/_form.html.erb (118.2ms)
  Rendered issues/_edit.html.erb (412.1ms)
  Rendered issues/show.html.erb within layouts/base (708.0ms)
Completed 500 Internal Server Error in 1486ms

ActionController::RoutingError (No route matches {:controller=>"welcome"}):
  app/views/issues/_edit.html.erb:34:in `_app_views_issues__edit_html_erb__790766123_99569424'
  app/helpers/application_helper.rb:950:in `labelled_form_for'
  app/views/issues/_edit.html.erb:1:in `_app_views_issues__edit_html_erb__790766123_99569424'
  app/views/issues/show.html.erb:129:in `_app_views_issues_show_html_erb__154495840_103779456'
  app/controllers/issues_controller.rb:118:in `show'
  app/controllers/issues_controller.rb:115:in `show'

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Anonymous over 12 years ago

I can't reproduce your error...

What are the changes you made to routes.rb?

I only changed the line containing

root :to => 'welcome#index', :as => 'home'

to

root :to => 'issues#index', :as => 'home'

and it works great... or did i miss any error logs? Do you have some kind of verbose logging activated? I grep'ed for your errors in the redmine folder and the system log folders.

My Environment:

Environment:
  Redmine version                          2.0.1.stable.9768
  Ruby version                             1.9.3 (i686-linux)
  Rails version                            3.2.5
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  no plugin installed
<pre>

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

hi there,

i copied the entry from you post and commented out the original entry. the log is the regular htdocs/logs/production.log.

i am running this with windows 7 embedded.

  - Redmine 2.0.3
  - Apache 2.2.22
  - ImageMagick 6.5.6-8-Q8
  - MySQL 5.0.83
  - Subversion 1.7.4
  - Ruby 1.8.7-p358-i386-mingw32
  - Rails 2.3.14
  - RubyGems 1.6.2

Plugins

  - projects_tree_view
  - redmine_ckeditor
  - redmine_inline_attach_screenshot

i tried by removing the plugins, but no success.

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

Hello,

i did it now the hard way, i changed welcome_controller.rb to redirect to another page. it works that way for me.

class WelcomeController < ApplicationController
caches_action :robots

def index
#@news = News.latest User.current
#@projects = Project.latest User.current
redirect_to url_for(:controller => 'issues', :action => 'index')
end
def robots
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'
end
end

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Anonymous over 12 years ago

Hello,

I have no idea if this has something to do with it, but you should use Rails 3.2.6.

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

hi,

I got the Version from the Readme of the Bitnami Stack, rails is 3.2.6

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Anonymous over 12 years ago

Are you shure about that? In one of the last posts you wrote:

...
 - Rails 2.3.14
...

Maybe you have both versions installed and Ruby is loading the wrong one?

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Ruedi Kneubühler over 12 years ago

well, i went to the commandline and entered rails -v and it told me 3.2.6

Since i installed the Setup http://bitnami.org/stack/redmine#nativeInstaller from Bitnami, i assume there is only installed what i need. i don't have any other installations that has ruby and rails.

RE: Solved: Redmine 2.0: routes.rb synthax has changed? - Added by Anonymous over 12 years ago

I don't have any idea. Maybe you could open a new thread regarding your problem.

Anyway. Thanks for your help.

    (1-11/11)