Newb question--help using plugin hooks in Redmine 0.8.4 and Rails 2.1.2
Added by Kyle Kilpatrick almost 14 years ago
Hello all,
My instructor in my college class has made the final project for the class to be to build a Redmine plugin (witha specific purpose) against Redmine 0.8.4 and Rails 2.1.2. Only problem is, I can't seem to get plugin hooks to work, even though my code is exactly what's in the example:
module SomeThing class Hooks < Redmine::Hook::ViewListener def view_issues_form_details_bottom( context={ } ) context[:controller].send(:render_to_string, { :partial => "hooks/someplugin/view_issues_form_details_bottom" :locals => context }) end end end
Using it causes Redmine to crash and produce this error:
/var/www/railsapp/vendor/plugins/redmine_someplugin/lib/someplugin_hook.rb:7: syntax error, unexpected tSYMBEG, expecting '}' :locals => context ^
Admittedly, all of us in the class are very new to Ruby AND Redmine AND Rails, so we're not really too well equipped for this project. I've been trying to read up on all three when I can, and have been learning somet hings in the process, but..
anyway, why am I getting this error? My code is exactly what has been provided on the Redmine site (unless I've missed something, which is entirely possible). Is the syntax for using plugin hooks in 0.8.4 different than what's in later versions?
Sorry for such a newbish question.... It
Replies (4)
RE: Newb question--help using plugin hooks in Redmine 0.8.4 and Rails 2.1.2
-
Added by Felix Schäfer almost 14 years ago
He's making you do rails 2.1.2? x_X Get out of this class…
Anyway, you're missing a ,
, the second parameter you're passing the send
method is a hash and should read {:partial => "hooks/someplugin/view_issues_form_details_bottom", :locals => context}
.
RE: Newb question--help using plugin hooks in Redmine 0.8.4 and Rails 2.1.2
-
Added by Holger Just almost 14 years ago
Cngratulations, you just found a typo in the docs :) Elements of a Hash need to be comma-separated. Thus, you need a comma behind the :partial => "hooks/..."
stuff. I just fixed it in the docs. Thanks for spotting it.
However, it probably helps if you read a bit about Ruby's basic syntax elements before starting coding plugins. That way, the error would have been easily resolvable :) Also, should really try to speak with your instructor about using something newer that Redmine 0.8.4. Writing proper plugins for Rails 2.3.5 / Redmine 1.0 is hard enough. There's no need to make your live so much harder by using a heavily outdated Rails version (which is broken in many ways).
--Holger
RE: Newb question--help using plugin hooks in Redmine 0.8.4 and Rails 2.1.2
-
Added by Kyle Kilpatrick almost 14 years ago
Turns out it wasn't actually the instructor who wanted us to use that version of Redmine and Rails after all.... That was just the version that the local IT guy gave us to work with. Turns out it's a Turnkey Linux distribution of Redmine. The instructor has actually suggested that we upgrade, which I am more than happy to do.
Here's the thing though... I'm having trouble with the upgrade process. I'm not actually doing it on the real thing yet, I'm doing a test on a Turnkey VM on my local machine, one pretty close (still using Redmine 0.8.4) to the one that the IT guy put on the server. I'm following the Redmine upgrade process, but I get stuck at the step where you're supposed to create the session store. I do the command:
rake config/initializers/session_store.rb
But rake says it doesn't know how to do that command. I got Rails upgraded to 2.3.5 (this is still just on my local VM, remember), and Ruby to 1.8.7, but no effect. I tried that command on the real server and get the same complaint. "rake generate session store" doesn't work either. Does the Turnkey version of Redmine lack something in this respect? My instructor got it to work on his own tests, so clearly there's a way around it... maybe I'll just have to ask him but, is there any advice you can offer as to why the session store generation isn't working?
P.S., I actually did read quite a bit of the Humble Little Ruby book earlier. Quite the interesting language, Ruby.
RE: Newb question--help using plugin hooks in Redmine 0.8.4 and Rails 2.1.2
-
Added by Alon Swartz almost 14 years ago
TurnKey Linux developer here. You might be interested to know that we released TurnKey Redmine 11.0RC [1] last month, which is now based on the Ubuntu Lucid 10.04 LTS, includes Redmine 1.0.2, Ruby Enterprise (for performance), as well as other features and enhancements [2][3].
If you have ideas on how we can make TurnKey Redmine better, please let us know.
[1] http://www.turnkeylinux.org/redmine
[2] http://releases.turnkeylinux.org/turnkey-redmine/11.0rc-lucid-x86/turnkey-redmine-11.0rc-lucid-x86.changelog
[3] http://releases.turnkeylinux.org/turnkey-core/11.0rc-lucid-x86/turnkey-core-11.0rc-lucid-x86.changelog