redmine_highlightjs icon indicating copy to clipboard operation
redmine_highlightjs copied to clipboard

1.0.2 code theme /my/account 404 Error

Open aliramw opened this issue 9 years ago • 11 comments

ActiveRecord::RecordNotFound (Couldn't find all CodeThemeUserSettings with 'id': (first, {:conditions=>["user_id = ?", 1]}) (found 0 results, but was looking for 2)):
  lib/redmine/hook.rb:119:in `block (2 levels) in render_on'
  lib/redmine/hook.rb:117:in `map'
  lib/redmine/hook.rb:117:in `block in render_on'
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:167:in `call_hook'
  app/views/my/account.html.erb:34:in `block in _cc579177290608748590be8a74c21b3f'
  app/helpers/application_helper.rb:1027:in `labelled_form_for'
  app/views/my/account.html.erb:14:in `_cc579177290608748590be8a74c21b3f'

aliramw avatar Sep 18 '15 08:09 aliramw

@marilawang: You problably missed db migration after upgrade, newer version introduces ability to set up theme per user and You seems to miss that.

dominch avatar Sep 18 '15 08:09 dominch

I have run

bundle exec rake redmine:plugins:migrate RAILS_ENV=production

aliramw avatar Sep 18 '15 08:09 aliramw

Did that created "code_theme_user_settings" table in db? I just checked again 2.4, 2.6 and 3.1 and it works everywhere without error

dominch avatar Sep 18 '15 10:09 dominch

Not work too

Migrating redmine_highlightjs (Syntax highlighting with highlightjs)...
== 2 CreateCodeThemeUserSettings: migrating ===================================
-- create_table(:code_theme_user_settings)
   -> 0.4642s
== 2 CreateCodeThemeUserSettings: migrated (0.4645s) ==========================

Error:

ActiveRecord::RecordNotFound (Couldn't find all CodeThemeUserSettings with 'id': (first, {:conditions=>["user_id = ?", 1]}) (found 0 results, but was looking for 2)):

Krakozaber avatar Sep 23 '15 04:09 Krakozaber

What versions are You running now?

dominch avatar Sep 23 '15 10:09 dominch

1.0.2

Krakozaber avatar Sep 23 '15 12:09 Krakozaber

What Ruby & Redmine version? :) I just checked and it's working on redmine2.4 + ruby 2.1.5

dominch avatar Sep 23 '15 12:09 dominch

Environment:
  Redmine version                3.1.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  4.2.4
  Environment                    production
  Database adapter               PostgreSQL

Plugin v1.0.1 work, v1.0.2 not

Krakozaber avatar Sep 23 '15 12:09 Krakozaber

Krakozaber: plugin v.1.0.1 don't have option to redefine theme by user in his account settings, and Your error is about that option. On my tested versions error is not raised when nothing is found, so I didn't needed to catch it. I'll take some time to make plugin compatible to work with code review, and try to reproduce this, it should be easy to fix, but I need to see it :)

dominch avatar Sep 24 '15 11:09 dominch

I was able to reproduce that and to fix it (I hope) Please review it :) (v1.0.3)

dominch avatar Sep 25 '15 14:09 dominch

Hello people! I had the same issue.

Well, looking carefully the redmine migration, the tables were not created. Without them, when processing the account details page, an db error is masked by 404 error.

The reason? In the installation instructions of the main page, the plugin directory name is missing the letter "t" in the name: "redmine_highlighjs" should be "redmine_highlightjs".

To solve the problem, please follow these commands (at the redmine dir):

  1. Force uninstall the plugin: $rake redmine:plugins:migrate NAME=redmine_highlightjs VERSION=0 RAILS_ENV=production
  2. Change the dir name: $mv plugins/redmine_highlighjs/ plugins/redmine_highlightjs
  3. Execute the plugin migrations: $bundle exec rake redmine:plugins:migrate RAILS_ENV=production
  4. Restart http server

I have already changed the README.md on my fork and submitted an pull request. I think that will solve the problem.

supergarotinho avatar Dec 24 '15 16:12 supergarotinho