dominch / redmine_highlightjs

A redmine plugin to highlight code blocks much better than coderay!
Other
22 stars 10 forks source link

1.0.2 code theme /my/account 404 Error #12

Open aliramw opened 8 years ago

aliramw commented 8 years ago
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'
dominch commented 8 years ago

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

aliramw commented 8 years ago

I have run

bundle exec rake redmine:plugins:migrate RAILS_ENV=production
dominch commented 8 years ago

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

Krakozaber commented 8 years ago

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)):
dominch commented 8 years ago

What versions are You running now?

Krakozaber commented 8 years ago

1.0.2

dominch commented 8 years ago

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

Krakozaber commented 8 years ago
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

dominch commented 8 years ago

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 commented 8 years ago

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

supergarotinho commented 8 years ago

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.