Savage Beast 2.0 – A Rails 2.0 Message Forum Plugin

Update: If you’re running Rails 2.2 or 2.3, see the newer version of Savage Beast.

I’ve been working the last couple days on creating a new version of the original Savage Beast plugin that is Rails 2.0 compliant and integrates the changes to the Beast source code that have been added over the last year. The result has been an interesting trek through the ins and outs of Rails plugin writing, that has given birth to a new version of the Savage Beast plugin, re-ported from scratch from the Beast trunk.

Installation

Currently, the following is necessary to use the Savage Beast plugin:

  1. The Savage Beast 2.0 plugin. Go to your application root directory and:
    svn export http://savage-beast-2.googlecode.com/svn/trunk/ vendor/plugins/savage_beast
  2. Most of the stuff you need to run Beast
    • Redcloth: gem install Redcloth
    • A bunch of plugins (white_list, white_list_formatted_content, acts_as_list, gibberish, will_paginate, engines). The easiest way to install these en masse is just to copy the contents of savage_beast/tested_plugins to your standard Rails plugin directory (/vendor/plugins). If you already have versions of these plugins, you can just choose not to overwrite those versions
    • For the engines plugin to work, add this line to the top of your environment.rb, right after the require of boot: require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
  3. Copy the migration in /vendor/plugins/savage_beast/db/migrate into your own migration directory (and run it)
  4. Implement in your User model the four methods in plugins/savage_beast/lib/savage_beast/user_init that are marked as "#implement in your user model
  5. Add the line “map.from_plugin :savage_beast” to your routes.rb. Location shouldn’t matter unless you intend to override it.
  6. Add the line “include SavageBeast::UserInit” to your User model. Location shouldn’t matter unless you intend to override it.
  7. Implement versions of the methods in SavageBeast::AuthenticationSystem (located in /plugins/savage_beast/lib) in your application controller if they aren’t already there (note: technically, I believe only “login_required” and “current_user” are necessary, the others give you more functionality). Helpful commenter Adam says that if you have the “helper :all” line in your application controller, be sure to add the “SavageBeast::AuthenticationSystem” line after that.

And off you go! When you visit your_site/forums something should happen. I’ve been creating new forums by visiting /forums/new. There’s probably a hidden admin view somewhere.

I’d like to remove some of these steps during the plugin install process with subsequent releases (is it possible to install a dependent plugin during your plugin install process?), but given that this is my first plugin project (and not a small one at that), I’m just trying to “get it done” before I “get it done beautifully.” I think DHH said somewhere that I should do that.

Implementing Your Own Views and Controllers

The engines plugin makes it eminently easy to mix in your own stuff as you see fit. Just create a new file in your /controllers or /views directories with the same name as the file you want to override in Savage Beast. If you just want to override a particular method in a controller, you can do that piecemeal if you just leave your XController empty except for the method you wanted to override.

If you’re integrating this into an existing site, I’d recommend you start by creating a forums layout page (/app/views/layouts/forums.html.erb). This will give you a taste of how easy it is to selectively override files from the plugin.

Demo

You can check out a (slightly-but-not-too-modified) version of Savage Beast online at Bonanzle. The differences between our version and the version checked into Subversion are 1) addition of topic tagging (users can tag topics to get them removed, etc) 2) recent post list shows posts in unique topics, rather than showing posts from the same topic repeatedly (there’s another blog on here about the SQL I used to do that) and 3) skinning. None of those changes feel intrinsic to what SB is “supposed to do,” which is why they aren’t checked in.

Differences from Savage Beast 1.0

The main difference is that this incorporates about a year’s worth of progress to the Beast source, and it actually takes that code a step further by being Rails 2.0.x compliant.

One thing Jodi seemed pretty excited about in the first Savage Beast was the ability to create forums off of models. Bonanzle doesn’t need that functionality, so I haven’t tested it, but I imagine it will probably work if you follow the steps that did it in the first Savage Beast.

TODO

Would be nice to have some help writing tests. Would also be great to figure out how to install this through the standard “ruby script/plugin install”.

Without Engines?

There are a couple means by which you can use this plugin without using the Engines plugin. I originally had intended to do this, suspecting that Engines would be a performance detriment. Turns out it’s not. But maybe you want to roll without Engines for some other reason.

The most dumb-easy way to get by without Engines would just be to copy the views, helpers, controllers, and models into your own project. Yes, it means having a lot more of all the above in your project, but it’s no worse than if you were coding the plugin from scratch yourself (actually, I’d argue it’s a lot better, since you didn’t have to do the work yourself :)).

Another way is to uncomment the code at the bottom of Savage Beast’s init.rb. Before I knew about the Engines plugin I created the code in there that simulates Engines without having Engines installed. The caveat is that you won’t get Engines’ ability to selectively override particular methods/views, and you need to copy all your helpers into the SB/lib directory, where they become global (yuck). If anyone out there has cycles to hone this Engines’-less approach, please email me and we can talk about getting those changes into the project.

Conclusion

Comments are most welcome. I’ll be checking in changes to the project as I find bugs and improvements in using it, but this is admittedly something I don’t have a lot of spare time to closely follow (see my other entries on the wonders of entrepreneurship). Hopefully others can contribute patches as they find time. If you like the plugin, feel free to stop by Agile Development and give it a rating so that others can find it in the future.

143 Replies to “Savage Beast 2.0 – A Rails 2.0 Message Forum Plugin”

  1. Awesome! I have a site coming up in a few months that will need a forum system integrated with it. I was thinking of hacking Beast into a plugin so it really makes me happy to see someone has done the work for me. 🙂 I look forward to using this project and contributing any enhancements I make back.

  2. I have a question about the Engines 2.0 requirement… I have an app that is not 2.0 compliant. Is there a way that I can still use this plugin while not being on the latest 2.0 version of rails? I am fairly new to rails so I am still learning how things are setup.

    Thanks,

    Andrew

  3. Hey
    I’ve tried following your guide, but I keep getting the following error when I try to start the webserver. I have rails version 2.0.2 and the latest gem version. What am I missing?

    Exiting
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:376:in `new_constants_in’: You have a nil object when you didn’t expect it! (NoMethodError)
    You might have expected an instance of Array.
    The error occurred while evaluating nil.empty? from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file’
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load’
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant’
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing’
    from /Users/rap/Documents/41concepts/Subversion root/simpledoc_old/vendor/plugins/savage-beast-2-read-only/init.rb:1:in `evaluate_init_rb’
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/rails/plugin.rb:79:in `evaluate_init_rb’
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings’
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/rails/plugin.rb:75:in `evaluate_init_rb’
    … 35 levels…
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from script/server:3

  4. @Andrew: There is an older version of the Engines plugin (the current, stable release version) that you could use with a pre Rails 2.0 engine. However, this version of the Savage Beast plugin uses named routes that are specific to Rails 2.0, so chances are you’d have to do some refactoring to get things to work right. If you aren’t on Rails 2.0, your best bet might be to use the previous version of the Savage Beast 1.0 plugin that from Jodi’s blog: http://nnovation.ca/blog/ (it’s down as I type this, but it is usually up)

    It has been tested with Rails versions prior to 2.0. I found that the documentation was somewhat spotty, but where things don’t work the way you would expect them, you can look at the instructions on installing SB 2.0 (the ones posted here), since the install process for both versions of SB are almost identical (SB 1.0 doesn’t use Gibberish, but that is the only significant difference that springs to mind)

  5. @Rasmus: Hmm… that is an error that I never saw during my development. What would be helpful would be to determine which of the plugins that SB is using that might be causing that error (since the error itself is not informative). A few ideas to try:

    * If you move the Savage Beast plugin into a temp directory (out of vendor/plugins) do you still get the error?
    * If you move the engines plugin into a temp directory (out of vendor/plugins) do you still get the error?
    * Did you add the line that the Engines web page mentions into your environment file?

    If you can narrow down the plugin and/or line that is specifically causing that error (and post what you find here), I could try to provide further assistance. I’d be interested to hear if others have gotten it working fine or had similar problems?

  6. I think, that I have this same problem. I have added this line with Engines boot file. When I remove SB plugin from vendor/plugins everythin looks all right. When I remove Engines plugins I still have this error.

  7. @Galdrian: Alright, I’ve found one problem: It looks like the Google Code name of the plugin (savage-beast-2-read-only) is interpreted to be the name of the plugin itself, which makes the routing for the plugin unhappy. It looks like the plugin needs to reside in a directory called “savage_beast” inside the /vendor/plugins folder. I’ve updated the instructions. I’ll see if I can get ahold of you or Rasmus directly to see if this resolves your problem or further steps are necessary…

  8. Yeah, success..

    The error message gave me a nil exception, but it was difficult to track down. Your email saved me. It was indeed the naming of the plugin folder that caused this.

    Your tutorial says that the plugin should be put in a folder called “savage-beast-2-read-only”. When this was renamed to “savage_beast” it worked (at least in the dummy project I set up to play with this that doesn’t contain more than a single “User” class).

    I haven’t been through all the functionality, but now I can see the forum.

    Thanx for all you help (and the plugin).

  9. Quick question, I’ve got savage_beast installed and sort of running, im having troubles though when i go to /forums I get the error uninitialized constant ForumsController, I’ve been playing around with it for an hour or so but can’t figure it out, any idea why this is happening?

  10. @Justin: Still having the error? Paste your call stack and I’ll see if it makes any sense. Sounds like a potential error with the Engines installation (which should find the ForumsController in the SB /views directory)

  11. Bill, Yes i got that part working now it was a mistake I made when setting it all up, I am onto another problem now though. I’m setting up the forums inside an existing rails app and i can get to /forums just fine, but then I start running into problems. whether or not I’m logged in, when i head to /forums/new I get redirected to my login page, So I guess I don’t understand why login_required in my main app works, but inside the forums it always assumes I’m logged out. Any ideas?

  12. EDIT: So i know what the problem is, just not how to fix it yet. It has to do with my authenticatedsystem (restful authentication). When I restart mongrel and hit refresh on /forums it loads fine, then if i hit refresh again the error comes up. It seems like it’s unloading my authenticatedsystem after 1 page refresh for some reason. I tried adding ‘include AuthenticatedSystem’ inside savage_beast/app/controller/application.rb but still get the same error.

  13. UPDATE: okay I seem to have figured out the problem, you need to add ‘unloadable’ to the forum controller because of the way it loads the plugins directory. So far everything seems to work okay with this fix

  14. Back with another error. Most of the stuff is working okay, Im having trouble with display_name in places, but i just change it from user.display_name to user.login and it works fine, the problem I have now is when I try to create a new post on a forum i get “User expected, got User”, and it’s happening in the assign_protected call, but I don’t understand why it got ‘user’ and gave me an error when it was looking for ‘user’

  15. UPDATE: 1st, sorry for all the posts, I should wait to comment till I test a little more. The problem was similar to before with the ‘unloadable’ line, this time I had to add it to all the models in the beast app and it works fine. cheers.

  16. @Justin: It’s funny, I got that “User expected, got User” error myself when I first started working with SB. I concluded it was the Engines plugin, because after I uninstalled Engines, I stopped getting it. But when I reinstalled Engines a few days later I couldn’t get it to happen again. The weird thing was that I got that error repeatedly the first day I was playing with SB, and have not been able to get it since, using it for more than a month now. It’s wily and mysterious bug that vanished without my having done anything remarkable to fix it. But it sounds like you have found one specific approach to make it go away, which is good.

  17. @Justin: If you don’t mind my asking what was the issue with the uninitialized constant ForumController error? I’m getting the same error.

  18. About uninitialized ForumsController – I’ve also faced this issue, and it was because I did not properly install engines plugin. It needs the following line to be added to environment.rb (see its readme file for details):

    require File.join(File.dirname(__FILE__), ‘../vendor/plugins/engines/boot’)

  19. Now I have another problem – implementating auth system methods doesn’t work for me.
    SavageBeast::AuthenticationSystem methods are being called instead of ones of ApplicationController.
    For now I will add implementation directly to internals of SB, but I’d wanted to know what is the better way or how to get implementation working from my application code?

  20. In addition to my last post – I’ve put implementation into AuthenticationSystem itself, and it seems to workm but sometimes current_user method is being called onto ApplicationController and that produces error:
    “A copy of ApplicationController has been removed from the module tree but is still active!”

    I’ve googled on this, found some Trac reports and other notes, but found no solution. Connection between plugin and applicaton seems to be quite tricky…

  21. Sorry for posting so mush messages, but I got SB working almost good enough – I have to do some tweaking yet.
    (But I had to force application.rb and user.rb loading in environment.rb, so they are not reloadable now)

    And there are some more issues:

    1. Forums can be created (via /forums/new/ even when user is not an admin).
    That is why SavageBeast::AuthenticationSystem#admin? is used as before_filter, but when it is implemented like in example code it doesn’t do any redirect or something like. Correct before_filter must perform redirect instead of just returning boolean value.

    2. User.logged_in? seems to never been called

    3. In SB there is missing application.js, containing javascript for forum popup forms.
    I’ve got it from original Beast and it works ok, while without it it is not possible to post a reply

  22. @Bill: Hey I’ve been messing with the forums the past couple days and been havin fun, though it’s my first experience with textile so it took me a while to figure some formatting stuff out. Couple Q’s for you. first off I know the way it formats the post to textile uses RedCloth, I’m wondering how how hard it would be to make it so I can have traditional img links link [IMG]link[/IMG] . I assume it’d be re-writing part of redcloth. Next question is, do you have a way to quote text from another users post? I sorta looked through and didn’t see anything, and it wouldn’t be too hard to write up some code to do that, I just don’t wanna do it if it’s already been done. Cheers.

  23. @Kamaitati: In regards to the authenticationSystem modules, it is the Engines plugin that usually takes care of locating the local versions of those functions. If you look in your console output, you can see that every time a helper gets called, Engines goes through your list and finds where it should grab the helper from. For me, it always chooses the ApplicationHelper versions of those methods, but I’m not entirely sure how it chooses the order it will search in. Perhaps you could look at your console output and see if it is finding the helper methods in your Application controller, but ignoring them for some reason?

    As far as your other points, you are right on all three counts. I have checked in a new version of SB that addresses all of these issues. Thank you for your feedback.

  24. @Justin: Those are two good questions. So good, in fact, that I don’t know the answer to either. 🙂 For our site, I’m keeping the forums pretty dirt simple, not teaching users about formatting (yet) and not letting them explicitly quote past posts, though you are correct that it theoretically wouldn’t be difficult. Actually, I think the trickiest part of quoting past posts is that you’d have to declare which post you are quoting. The way Beast is setup by default, you respond to a topic thread, not to a particular message in that thread, so you would need to update the UI such that you were responding to a specific message. The UI sounds more difficult than the programming to me.

  25. @Bill, Thanks for your answer. I’m gonna make up a quote message function, won’t be hard since the posts are already labeled post-*id* Just need some javascript to grab the value of the post throw it into some block quote. I’ll post the code when I get it written up in case someone else wants to use it. AS for the [img][/img] I went into redcloth.rb and found where it renders images, and replaced the !’s with [img][/img], but the problem (i now believe) has to do something with white_list, because if you try to add [img] tag to your post it just gets stripped out, so it works in redcloth now, just white_list is killing the tags D: I’ll post updates later 🙂

  26. @James: Thanks for uncovering one of the dependencies I didn’t even know about (since I already had that installed). I’ve updated the instructions.

  27. I got only as far as point 3. and then I realized I cannot generate any migrations or run them. It seems the savage_beast plugin doesn’t like ActiveRecord and breaks things. After installation of savege_neast I’m getting the following error when I try to generate a migration:

    ./script/generate migration moj_test2
    /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:376:in `new_constants_in’: You have a nil object when you didn’t expect it! (NoMethodError)
    You might have expected an instance of Array.
    The error occurred while evaluating nil.empty? from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in `load_file’
    from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in `require_or_load’
    from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in `load_missing_constant’
    from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing’
    from /home/kopszak/PRACE/METARAILS/mc-temp/okle-b/vendor/plugins/savage-beast/init.rb:1:in `load_plugin’
    from /usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:407:in `load_plugin’
    from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings’
    from /usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:407:in `load_plugin’
    … 9 levels…
    from /usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/generate.rb:1
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from ./script/generate:3

  28. @Piotr: You don’t need to generate the migrations. The migration file you need is already provided for you in the savage_beast/db/migrate directory. There is one migration file there. If you copy that to your db/migrate directory and rename it to be your newest migration, all should be well.

  29. @Kamaitati and Bill:

    I figured out the problem with AuthenticatedSystem methods not being called and disappearing. I had placed the call to include AuthenticatedSystem in application.rb right before the default “helper :all # include all helpers, all the time” line. Placing it just *after* that line fixed everything. I’m guessing that Engines was causing the SavageBeast::AuthenticationSystem to be included over the AuthenticatedSystem because of the inclusion order.

  30. Thanks Adam. Your post brings up an interesting idea — perhaps I should just include versions of the necessary plugins (as they’ve been tested and working with my version of SB) along with the SB install. This would mean that (1) we aren’t as beholden to the trunk versions of these plugins not changing and (2) it is less install steps without all those plugin installs. Of course, for those that already have versions of the plugins they wanted to keep, they could just not use SB’s versions of those plugins.

    I’ll try to find some time to do that in the next week. I’m also still extremely interested in being able to install SB 2 through a standard ruby script/plugin install, hopefully my new “Advanced Rails” book can illuminate how to do this in enough simplicity that I can squeeze it in soon.

  31. I had the problems with unloaded models as well – the display_name problem, etc. Some of my error pages actually complained that the stack was too big; instead of method_missing it was trying to call method_missing_with_paginate from will_paginate, and that just led to all kinds of strife.

    I finally found a newsgroup posting with the fix – it took care of all the problems in one shot:
    http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f84896c2955579af?fwc=1

    Thanks for sharing the beast!

  32. @Peter@ Great tip for a problem that I think many others will appreciate. I’ve updated the install instructions so that people will be able to find this information.

  33. Alright, I added the Google Groups fix pointed out by Peter into the source, so hopefully the engines unloading modules problem should be no more.

  34. I was having issues with a users_path variable not being found. Adding map.resources :users to routes.rb fixed the issue.

    Im brand-spanking new to ror, so this may be trivial for some.

  35. It’s a gibberish thing. All the strings are stored in a YML file. I don’t remember which one (en.yml?). I’d recommend that you A) Look at where gibberish gets its strings from or B) do a find all in your project for whatever the text is that ends up being used in the title variable (when you see it in the view)

  36. Hi Bill, thanks for that–

    I’m now getting this error, scattered about my site:

    NoMethodError in Topics#new

    Showing vendor/plugins/savage_beast/app/views/topics/new.html.erb where line #8 raised:

    undefined method `display_name’ for nil:NilClass

    Extracted source (around line #8):

    5:
    6:
    7:
    8:
    9:
    10:
    11:

    I’ve implemented display_name as a single line in my User model. It is “self.login.” Current_user is set in my application controller as session[:user] — when I put a debugger statement in the respective controllers (i.e., in this case it would be topic), current_user.display_name returns correctly. However, the debugger statement placed in a view shows me that both current_user and display_name and logged_in? etc are all nil, thus not accessible from the view. How may I approach this?

    Very much appreciated.

  37. well I gave up on the display_name problem. Cycling through a million different files looking for a line of code that may or may not be there that you may or may not notice whose form you’re unsure of is like searching for a pin in a haystack. Andrew’s tutorial didn’t work integration-wise so I’m testing it verbatim from scratch.

  38. By Andrew I meant Adam. Thanks Adam. Creating a project from scratch and following your instructions verbatim results in a working Savage Beast. Thanks Savage Beast.

  39. Sorry for posting such a basic request, but I am coming from java land and need a bit of help here. Could someone post the basics of what should be in user.rb file to get things moving here?

  40. almost have this working.

    on one computer, i am getting the following error:

    uninitialized constant Rails::Plugin::RedCloth

    on another, i am getting:

    NoMethodError in Forums#show

    Showing vendor/plugins/savage_beast/app/views/forums/show.html.erb where line #33 raised:

    undefined method `has_key?’ for :rss:Symbol

    which comes from

    anyone have any idea how to get past these errors

  41. Hi Bill,
    sorry to bother you again, but I have one other problem
    I did some modification to my installment of savage beast 2 but I am getting the following error whenever I edit and create forum, topic, or post

    NoMethodError (undefined method `controller_name’ for nil:NilClass):
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:655:in `callback’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:637:in `after’

    after some investigation, for some reason the *_path are not returning restful url.
    for example,
    /forums/1/topics/1/posts/11/edit?page=1
    now becomes
    /posts/11/edit?forum_id=1&topic_id=1

    and i think this is why my edit and create doesn’t work anymore.

    Do you have any idea why this is happening and how to fix it?
    Thanks in advance!

  42. Hi,
    I want to use savage beast for my website . But I am on rails 1.2 and I am facing compatibility issues with savage beast. Do we have any workaround to get it working?

    Thanks,
    ~S

  43. Hi Bill,

    Just want to report a bug,
    When I try to delete topic as admin, I get

    NoMethodError (undefined method `update_posts_count’ for #):
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:205:in `method_missing’
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/symbol.rb:11:in `__send__’
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/symbol.rb:11:in `to_proc’
    /vendor/plugins/savage_beast/app/models/topic.rb:85:in `each’
    /vendor/plugins/savage_beast/app/models/topic.rb:85:in `update_forum_counter_cache’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:in `send’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:in `callback’

  44. Hi,
    Thanks for this plugin.
    I am integrating beast into an existing site.
    When I perform /forums, I get the following error

    undefined method fond_ordered for …

    My trace on the server shows me that engine is not able to loacate forums_controller, forums_helper

    I am able to see the forum/new page but run into problems when I try to create a new pose.

    Is my error due to some missing configuration to load beast plugin corrrectly.

    Thanks,
    -Ram

  45. “undefined method fond_ordered for €¦”
    should read
    “undefined method find_ordered for €¦”

    I see that this method is defined in the SB plugin.

  46. We are using the will_paginate gem on a project that has Savage Beast installed. (This has recently been updated from a plugin to a gem.)

    On 04/07/08, the developer changed the “page_count” method name to “total_pages” that is hanging off the model. Savage Beast uses “page_count” which was “giving me a undefined method page_count” error in quite a few places. I had to do a find/replace to change these all to total_pages and all appears to be working now.

  47. @Ryan@: Thanks for the report. I’ll look into that next time I’m updating the plugin. Let me know if you fix it yourself and could give me specific code to add to the project.
    @Ram@: I think that is a default Rails route? Never seen that particular error. Maybe someone else who has will chime in.
    @Jim@: Thanks for the tip. I’m sure others using the gem version of will_paginate will appreciate this.
    @Krzysztof@: I don’t have the original SB, but I know that nnovation.ca/blog has a history of being up and down (was down for a couple days when I first tried to grab it). Keep at it, email Jodi Showers if you can find his address. And maybe bug him to put the project on Google or RubyForge… 🙂

  48. hi bill,
    I think the problem is that it’s trying to update the post count of all the user in that topic, but the User model doesn’t have that function update_posts_count anymore. I don’t need savage beast to track user post count, so I simply commented out that line

    #@voices.each &:update_posts_count if @voices

    and it works perfectly now

  49. I also was experiencing the oddness of seeing Dutch languge activerecord errors… it was because of an incomplete removal of the GetText gem translations previously being done by savage_beast. Nothing to do with Gibberish plugin, as a previous response had claimed.

    Commenting these two lines out from the init.rb makes everything good again:
    # require ‘gettext/rails’
    # GetText.locale = “nl” # Change this to your preference language

    Thanks for working on getting savage_beast up to speed on Rails 2.0!

  50. Hi,
    where should i set value of variables users_path and forums_paht, any maybe other?
    thank you in advance
    Krzysiek

  51. Is there a Google Groups available for this plugin? It would act better as a place for support.

    My question is, how do I delete a forum once created?

    I see the controller function is there, but it doesn’t seem to be linked from anywhere in views.

  52. Zac, I believe there is a Google Groups-like thing in the Google Code project, but I hardly ever visit it. Others might.

    In regards to your question, I know that an edit/delete link pop up when you mouse over a topic, but I believe that the Beast thinking is that Forums are generally static, whereas topics within Forums come and go (e.g., are created and deleted frequently). Thus, whatever link there might be to delete a forum is probably well hidden within the standard Beast views.

    But I don’t know for sure, because in practice, and certainly with us, most apps overwrite the standard Beast views before they get to production, so once those views have been replaced by your own (which is as easy as just creating the overriding view partials in your app/views/* directory), then the links that are provided to add/edit/delete are totally up to you.

  53. @tito: Access to edit or delete posts is dictated by the admin? method in SB, as I recall (without the code in front of me right now). If not admin, there’s some other similar method that dictates that. It was one of those things that “Just worked” for me, so hopefully it will with you too.

    @wilson: A good idea. I’ll take another look in the next few days to see if Git for Windows has reached the point of being decent yet, and if so, hopefully move over SB in the near future.

  54. We just spent some time making savage beast compatible with Rails 2.1. Since we couldn’t find any information out there while we were sorting through the errors, I’ll post our fixes here in case anyone else encounters similar issues.

    1. All the named routes in savage_beast started throwing exceptions. We found that an update to RESTful routing started to automatically prefix nested resources. SB doesn’t follow this convention. To fix, we had to pass an extra “:name_prefix => nil” to our nested routes in SB’s routes.rb, like so:

    map.resources :forums do |forum|
    forum.resources :topics, :name_prefix => nil
    forum.resources :topics do |topic|
    topic.resources :posts, :name_prefix => nil
    topic.resource :monitorship, :controller => :monitorships, :name_prefix => nil
    end
    end

    2. We’ve been using the will_paginate gem and of course, this also caused incompatibilities with SB, which was depending on an older version of will_paginate. To fix, we had to change all instances of @post_pages or @topic_pages to @posts and @topics, respectively. Also, the method page_count had to be replaced with the new total_pages. Lastly, the method “pagination_links” had to be changed to “will_paginate”, with the appropriate collection as the param.

    3. Voices. I love the “voices” feature of SB, but that also stopped working. Two easy changes here: in the views, just change @voices to @topic.voices. When SB needs to update the forum counter cache, it tries to call a method “update_posts_count” on a “voice”. For us, that’s a user, so I added this to our user.rb:

    def update_posts_count
    self.posts_count = Post.find(:all, :conditions => {:user_id => self.id}).size
    self.save
    end

    4. Finally, we ran into a strange 502 Bad Gateway issue when deployed into our nginx/mongrel environment. It only happened with IE when creating a new post. Turns out the Post#create redirect passes an :anchor param, which generates an HTML anchor (#) symbol in the URL. This was causing problems with nginx in IE only. The simple fix was to simply remove the :anchor param, since all it was doing was scrolling the user to the new post.

    And now we’re rolling with SB on Rails 2.1…

  55. Chris — you’re a saint!

    We’ll probably be moving to 2.1 in the next couple months, I’ll definitely refer to your guide when we make the jump, and check in the changes at that time.

    Do you think these changes will be backward compatible, such that we could update the main code base to work with Rails 2.0.x and 2.1?

  56. Bill – I don’t see anything that would break with Rails 2.0.x The :name_prefix param should just be ignored in older versions of RESTful routing. Good luck!

  57. i get the following error when i tried to do the migration.I am using rails 2.1.Can you please provide me the steps for getting out of this problem. I am struck here.I googled but it was of no use

    undefined method initialize_schema_information’ for module `ActiveRecord::ConnectionAdapters::SchemaStatements’

    i commented the following line in migrations.rb and was able to work to some extent.But i am facing problems in will paginate plugin’s init. can you provide me a permanent solution?

    def self.included(base) # :nodoc:
    # base.class_eval { alias_method_chain :initialize_schema_information, :engine_additions }
    end

  58. @prabha: I’m not on Rails 2.1 yet, but hopefully Chris or another user that is can speak to your problem. Bonanzle probably won’t be moving to 2.1 for another month or two. There’s a lot to be done.

    If anyone who gets SB working with Rails 2.1 and would like commit access to the SB repository, I’m game for that, as long as it remains 2.0.x compatible.

  59. prabha – haven’t seen that before. But if you’re having issues with the will_paginate plugin, maybe the easiest thing to do is to upgrade to the will_paginate gem (sudo gem install will_paginate), and then follow the instructions in my earlier post.

    bill – I may be adventurous enough to give it a shot. But I’m working from Beijing at the moment and don’t have too much spare time. Have you also considered hosting it on github? That may open up contributions a little.

  60. I just installed to a Rails 2.1 project. The migration was not an issue. No idea why @prabha would be having issues with that.

    However, there was an issue with the “will_paginate” plugin. It was given a “stack level too deep” error when accessing the Topic view.

    This issue was an issue with an old “will_paginate” and Rails 2.1.

    http://err.lighthouseapp.com/projects/466/tickets/223

    Updating to the latest gem and referencing the gem via the environment.rb file corrected the issue.

    Unfortunately, I am now getting a “undefined method `page_count'” error.

  61. So it turns out I commented on this “page_count” error on April 15th. I thought it looked familiar. 😉

    To correct the issue, do a global find and replace of “page_count” to “total_pages”.

  62. @prabha: I have had the same problem today with rails 2.1, and you can solve it updating the engines plugin.
    Instead of use the version in tested_plugin, download the last version.

  63. Hey, I was wondering if anybody had a nice method or direction for overloading the posts class. I am using a blog and I want to use this for a forum plugin, but since savage beast and my blog use the posts class it causes issues. Does anybody have some suggestion?

  64. Hi,

    I am getting the following error when am trying to svn export :

    Error: REPORT request failed on ‘/svn/!svn/bc/9/trunk/vendor/plugins/savage_beast’
    Error: ‘/svn/!svn/bc/9/trunk/vendor/plugins/savage_beast’ path not found

    Could someone please suggest any solution or alternate way to get the plugin installed?

    Thanks,

    Disha.

  65. I get a bunch of information added to my server after implementing forums using savage beast.Is there a way to cut that off? Can anybody help me?

  66. @Disha: What address are you trying the export? The one you’re listing there appears to be different than the http://savage-beast-2.googlecode.com/svn/trunk/ address at which the plugin exists.

    @Prabha: You’re probably observing the output of the Engines plugin. On my install, I commented out most of the debug info given by the Engines plugin by going into the Engines plugin and commenting the line that was doing most of the blabbering (don’t remember which one it was anymore, but do a find all for whatever the text you’re seeing is).

  67. Hey Bill – thanks for working on this plugin, ever since I first discovered Beast I’ve wanted to add it to an existing site, rather than having to create a new one…

    I’m trying to use SB without Engines. You mention above that the easiest way would be to just copy the controllers/helpers/models/views into my own app, which I’ve done. Of course I immediately get some errors about no `admin?` method in forums_controller.rb The only place I see a non-model `admin?` method is in /lib/savage_east/authentication_system.rb There’s a comment at the top that says “override in your app controller” Override what? Should I copy all of those methods into application_controller.rb and then uncomment the bodies of the methods?

    /lib/savage_beast/user_init.rb mentions implementing a few of the methods in my own user model (there are specific comments above `admin?` and `display_name`) and then everything below the `ClassMethods` module…if those are really class methods, should I actually copy them into the model with `self.` in front? Should I just copy everything, ignoring the `base.extend` and module definitions, of course.

    Is there anything in /init.rb that I need to worry about?

    Should I just shut up and use Engines like you intended? 🙂

  68. @Rob: Heh, Engines isn’t exactly the daintiest plugin… at all… so I can understand the initial aversion to it, I certainly felt the same way, though I have since come to love it and use it for many other subsystems in my app (like our feedback and blog systems). But that isn’t really your question.

    The “override in your app controller” means that, for each method at which you see that, you should create a method in your application controller that implements that functionality in a way consistent with how you define an “admin” (or whatever) user in your application.

    Same with the user model. Since everyone might have a different way that they define the display_name for the user, it’s intended that your user model will implement all of the methods that SB says “implement in your own X.”

    You shouldn’t have to worry about anything in init.rb, you’ll just need to make sure that you get all the routes into your routes.rb from the SB routes.

    Hope that clarifies things a bit.

  69. Hi Bill,

    just wanted to ask if there is an easier way to style the forums without having to explicitly state in the controller that the layout to be used should be forums.rhtml.erb? I tried overriding the file as you said(by creatign a forums.rhtml.erb file in my layouts folder) and it worked fine…for the index. when i clicked on a post, it proceeded to use the application default layout.

    Also, what about shared partials? I am planning to clean up my application or forum layout by dividing the sections into partials, but when i tried making a /shared/ folder for my partials in my app/views/layout folder, savage beast still keeps looking for those shared partials in its own views/layout folder.

    thanks!

  70. my friend gave me a good suggestion for the shared partial problem: just make an empty “shared” folder in savage_beastappviews and if you are using the engines plugin, it will “overwrite” the shared folder with what you have in your app’s shared folder.

    the only remaining problem for me is that the topics controller and the post controller is loading the application.rhtml.erb instead of the forum controller. is this really the case by default?(and thus i have to override those controllers to force them to load the forums layout?) thanks again in advance!

  71. …just found out about savage beast.

    fyi, if you’re getting this error message reported by @prabha on rails 2.1:

    undefined method initialize_schema_information €™ for module `ActiveRecord::ConnectionAdapters::SchemaStatements €™

    you can fix this by not using the engines plugin in the tested_plugins and instead getting the latest:

    cd vendor/plugins
    git clone git://github.com/lazyatom/engines.git
    git checkout 2.1.0

    cheers,
    tom

  72. Thanks so much for the great work. Just got it up and running in Rails 2.1.1 and mostly just had trouble with plugins, like €œpage_count € method name to €œtotal_pages € for will_paginate. Your savage_beast plugin will show up in the wild at the LegalTorrents.com website in a few days.

    I’m curious if the plugin will track altered_beast. True to technoweenie’s form, beast-2.0 is not called beast-2.0, but altered_beast: http://github.com/courtenay/altered_beast/tree/master

    It would be pretty cool if savage_beast was an actual fork at github of altered_beast…

    Thanks again for making savage best 2.0…

  73. *Austin Web Developer, this is one possible way to do step 4:

    class AddAdminToUsers false
    end
    def self.down
    remove_column :users, :admin
    end
    end
    ——— user.rb —————-
    def display_name
    if current_user.login.blank?
    current_user.name
    else
    current_user.login
    end
    end

    def self.currently_online
    User.find(:all, :conditions => [“last_seen_at > ?”, Time.now.utc-5.minutes])
    end

    def self.build_search_conditions(query)
    query && [‘LOWER(login) LIKE :q’, {:q => “%#{query}%”}]
    query
    end

  74. *Austin Web Developer, this is one possible way to do step 4:

    **repost, the last code got munched some how…lets try again:

    {{{
    class AddAdminToUsers false
    end
    def self.down
    remove_column :users, :admin
    end
    end
    ——— user.rb —————-
    def display_name
    if current_user.login.blank?
    current_user.name
    else
    current_user.login
    end
    end

    def self.currently_online
    User.find(:all, :conditions => [“last_seen_at > ?”, Time.now.utc-5.minutes])
    end

    def self.build_search_conditions(query)
    query && [‘LOWER(login) LIKE :q’, {:q => “%#{query}%”}]
    end
    }}}

  75. My bad:

    1) The migration above is still being eaten cause I don’t know how to post code to wordpress. But it simply adds an example admin boolean to users.

    2) I misspoke, altered_beast isn’t the official fork of beast…I just got confused as I saw technoweenie’s commits on altered_beast. I did notice though altered_beast has movement and technoweenie also has his own fork of altered_beast on github…

    ok, back to adding Rick’s viking fork to savage_beast for Spam filtering: http://github.com/technoweenie/viking/tree/master/lib

  76. so I just copied the following and placed it in my user.rb

    def display_name
    if current_user.login.blank?
    current_user.name
    else
    current_user.login
    end
    end

    def self.currently_online
    User.find(:all, :conditions => [ €last_seen_at > ? €, Time.now.utc-5.minutes])
    end

    def self.build_search_conditions(query)
    query && [ €™LOWER(login) LIKE :q €™, {:q => €œ%#{query}% €}]
    end

    is that all I need to do? I’ll keep moving forward to see if this works.

  77. I am trying to add this to substruct and I pasted the map.from_plugin :savage_beast and I get this error:

    /Users/nathan/Sites/projects/ror/1stmarine/vendor/plugins/savage_beast/init.rb:30:in `from_plugin’: undefined local variable or method `map’ for # (NameError)

  78. Hi

    I have problem with authenticated system.
    I have User model and i have already added authenticated(acts_as_authenticated)plugin for my application.
    included AuthenticatedSystem in my application controller.

    now, I added savage beast, its working nice.
    But if i clicked on Create new Forum,its goes to login page ,
    another one is users_path undefined method, and current_user is nil

    how to fix those problems with authenticated system.

    i didn’t do any changes in savage beast application controller and my application controller
    only i added 4 methods to user Model.

    how to connect my application with forum.

    please help me.

    thanks.

  79. Hi,
    I am facing new issues with above issues
    i cant give a reply for the topic.

    if i click on Reply to Topic link,it is not going any where.
    how to give reply for the topic?

    thanks,
    ravi.

  80. I encountered problems with engines when my rails version is on freeze. Could someone enlighten me about this issue? The engines is fine though when rails is not freeze.

  81. Hey Ravi,

    I think the reply uses Javascript and RJS… tho I haven’t heard any specific issues with it before. Be sure to post it when you figure out what your problem is.

  82. P.S. Judging by the fact that several thousand people have downloaded SB in its months of existence (at least 50 people visit this blog per day), I’m betting that it is probably online at many Rails sites that use forums.

  83. Hi all. No update for Rails 2.1 ? I’ve a lot of difficulties with routes 🙁
    undefined local variable or method `users_path’
    or
    undefined local variable or method `new_session_path’
    even my restful seems kaput:
    No route matches “/login” with {:method=>:get}
    :((((
    if someone has an idea…
    I’m running Rails 2.1.2 & engines 2.1.2

  84. mode autoresponse: It seems that ‘map.from_plugin :savage_beast’ is not working in my route.rb…
    If I take all routes defined in ‘vendor/plugins/savage_beast/routes.rb’ and put it directly in route.rb of my app, it’s working. cool.

  85. @Ravi: The problem you mentioned about Reply to Topic link not working, is because in the layout application.html, “application.js” is wrongly included before “prototype”, “effects” (hence the show/hide/toggle functions weren’t working)

    Bill, please correct the actual plugin code. Loving the Savage Beast! I am about to launch it on my site: http://www.chictini.com

  86. You might get this error after upgrading to Rails 2.2:

    uninitialized constant Rails::Plugin::Dependencies

    You need change savage_beast/init.rb:
    Rails::Plugin::Dependencies

    to

    ActiveSupport::Dependencies

    Zac

  87. I was ALSO having issues with a users_path variable not being found.

    Adding map.resources :users to routes.rb didn’t fix it, but when I moved the map.from_plugin :savage_beast so that it happened before the map.resources :users line, then everything started working.

    –Tyler

  88. Does anyone know a good way to port the data/postings from an existing Beast forum to Savage beast?
    (is it even possible?)

    thanks.

  89. Note: In part 2.1, “Redcloth” should be “RedCloth” – with a capital ‘C’. The gem install could not find gem “Redcloth” otherwise.

    gem install RedCloth

  90. I’m also running into the uninitialized constant ForumsController problem…I do have that line added to environment.rb…feels like repeatedly slamming myself against a brick wall as a rails newbie sometimes!

  91. Jirapong’s instructions have moved to http://bananacoding.com/Blog/Savage-Beast-Forum-Installation but the images are missing. I managed to install it on Rails 2.2.0. Some remarks:

    * Don’t overwrite restful_authentication with the copied files from vendor/plugins/aep_beast/tested_plugins

    * In routes.rb, it should be
    map.from_plugin :aep_beast # not :savage_beast

    * For some reason restful_authentication didn’t create a config/initializers/mailer.rb for me – set up your smtp_settings or nobody will be able to register!

    * change YOURSITE and ADMINEMAIL in app/models/user_mailer.rb (hiding stuff like that in some string literal in a view is a real antipattern, those parameters should be defined in an initializer so whoever installs the plugin sees them)

    * And you need to define a users/index action for the “Users” link. Something like
    def index
    @active_users = User.find(:all).select(&:active?)
    end
    and decide who should be allowed to see the list.

  92. I installed everything as instructed above, and when i start server, or infact even when i run rake (for migrations) or generator (for scaffolding) it is breaking and throwing up this error : c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method’: undefined method `initialize_schema_information’ for module `ActiveRecord::ConnectionAdapters::SchemaStatements’ (NameError) Any clue why this mite be happening?

  93. Hi Bill,

    I downloaded your Savage Beast to work with my Rails 2.3 project. Here are the changes I needed to make:
    * need a version of engines that’s compatible with the version of Rails, since a lot of code has been moving
    from Engines to Rails (git://github.com/lazyatom/engines.git)
    * the migration should be renamed before copying to the migration directory so it doesn’t conflict (I’m using timestamped migrations)
    * in init.rb, need to change “Dependencies.load_once_paths.delete(path)” to “ActiveSupport::Dependencies.load_once_paths.delete(path)”
    (dependencies are part of ActiveSupport now, according to http://sagarkulkarni.com/2009/03/02/getting-weborb-to-work-with-rails-22-const_missing-uninitia-lized-constant-railsplugindependencies/)
    * (note for Mac users, no RedCloth precompiled version for Mac, so you need XTools installed)
    * according to Rails 2.3 release notes, no need to “Add the line €œmap.from_plugin :savage_beast € to your routes.rb” as rails now automatically includes your mappings, but I still needed to add it.
    * I got the error message “Rails::Plugins::RedCloth not found”, even though I had installed RedCloth as a gem. To get around this, I had to add the line “config.gem “RedCloth”” in my environment.rb.
    * got this warning message “/Users/jobsearch/Documents/Rails/19gale/vendor/plugins/white_list_formatted_content/init.rb:5: warning: default `to_a’ will be obsolete”
    * this is because “Object.to_a” will dissapear in Ruby 1.9. Changed to Array(options)
    * got warning “DEPRECATION WARNING: formatted_forum_posts_path() has been deprecated. Please pass format to the standard forum_posts_path method instead.. (called from _run_erb_vendor47plugins47savage_beast47app47views47forums47show46html46erb at vendor/plugins/savage_beast/app/views/forums/show.html.erb:33)”
    * changed “formatted_forum_posts_path(@forum, :rss)” to “forum_posts_path(@forum, :format => :rss)” wherever found
    * got error “undefined method `to_i’ for {:page=>nil}:Hash” on line #25 of forums_controller.rb
    * paginate method is being called improperly, as it uses default arguments, not options.
    * changed “@forum.topics.paginate :page => params[:page]” to “@forum.topics.paginate( params[:page] ? params[:page] : 1 )” and fixed the problem.
    * (note if you pass 0 or nil as the page #, you get an array, not a collection back).
    * same issue (paginate method) for topics_controller, same fix
    * got error “undefined method `email’ for “#”:User”. Your documentation doesn’t mention you need an “email” method for user.
    * got warning “DEPRECATION WARNING: truncate takes an option hash instead of separate length and omission arguments.”
    * changed all instances of truncate(a,b) to truncate(a,:length=>b). Includes 2 instances in white_list_formatted_content/init.rb
    * when I click on “Reply to topic”, nothing happens. There doesn’t appear to be a function ReplyForm.init()
    * plugin javascript was not included. I added an extra “content_for :head” in topics/show.html.erb as I’m not sure if I want this script available for the rest of my application.
    * “n n”
    * Fixed typo “Administator” => “Administrator” in topics/show.html.erb (not related to port, but just to let you know…)

    Hope this information is useful,

    Thomas O’Dell

  94. Believe it or not, I actually created a Github project, moved Savage Beast into a project directory with Git, and started making the changes to get it Rails 2.3 compatible. I’m being contracted to make a 2.3-compatible (and fleshed out) version of Bloggity, so I’m going to try to kill two birds with one stone here.

    So this checklist will be extremely helpful in bringing SB in the 2009s. Thanks Thomas!

  95. Actually, William, it would be cool if you contacted me (via email or any-method from my website) — we did some work with our fork of Savage Beast (named it Aep_Beast) to make it Rails 2.1-compliant (and clean up some code ;)) and I think you could use/merge our fork and start from that point onwards.

  96. Hi Bill, looking forward to a 2.3 compatible Savage Beast. Let me know if/when code is pushed to GitHub. I would love to help out; I think it would be great for a current project I’m working on.

  97. Hey Tomash,

    Thanks for your generous offer! Hopefully you received my email today that I’d like to try to work with you over the long term to merge the two as best we can. For starters, though, I’d just like to get SB working with 2.3 via the changes suggested above. I don’t think this will tkae me more than a couple hours time, after I actually have those couple hours available (have been spending my open source time this week on Bloggity).

    You can watch the developments unfold at
    Savage Beast:
    http://github.com/wbharding/savage-beast/tree/master

    and Bloggity:
    http://github.com/wbharding/bloggity/commits/master

    I’ll make announcements to the blog when they get to the point of being consumable. Since I’ve been contracted to make progress on Bloggity, that’s getting first dibs; I have to be done with that by May 15. SB is going to be pretty easy to at least get to the point its running though, so I’m pretty sure I’ll be able to sneak in its updates within the next couple weeks as well.

  98. I’ve implemented this using the steps above and implemented current_user and login_required.

    I’m seeing the forums index and I can create a new forum. But I don’t see a “new topic” button on the topics index page.

    Ideas?

  99. Also, does anyone have an example of application.rb?

    What’s the actual code I put in application.rb to include the AuthenticationSystem? When it says override, do I write my specific code for those functions in the AuthenticationSystem file or in Application.rb?

  100. I’ve gotten the New Topic button to display, but now when I go to start a new topic, I get this error:

    You have a nil object when you didn’t expect it!
    The error occurred while evaluating nil.display_name

    Line 8: 8:

    This is in my Application.rb:

    def current_user
    @current_user ||= ((session[:user_id] && User.find_by_id(session[:user_id])) || 0)
    end

    I also tried:

    def current_user
    User.find_by_id(session[:user_id])
    end

    Why is “current_user” nil in the New Topic page?

    Thanks

  101. I have gone through all the steps an I am receiving this error when I attempt to start my server:
    /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant’: uninitialized constant SavageBeast::UserInit::Forum (NameError)

    I am using Rails 2.2.2. Any ideas on the SavageBeast::UserInit::Forum error?

  102. Hi Bill – first of all, thanks for SB! By any chance is there a version of savage beast compatible with rails 2.2.2? (eg that has a version of engines compatible with 2.2.2?) I’m running into some of the same problems that Thomas reported, but i think my problems may be the opposite of his, in the sense that at the time he was using 2.3 and SB wasn’t compatible. Now i think SB is compatible with 2.3 but i’m still using 2.2.2, and running into problems (with engine in particular). Ive asked on engine mailing list about a 2.2.2 version but thought i’d ask you if you’ve got a 2.2.2 SB in the archive.

    thanks!
    max

  103. Note the upgrade note at the top of the blog, SB has been updated for Rails 2.2 and 2.3! If you’re using those and have questions, please add them to the other blog post.

  104. Hi Bill,

    I’m trying to integrate the Savage Beast plugin into my site (like everyone else!) The thing is – this plugin assumes that the user-model is named ‘User’. My user-model in my site is named ‘Person’. Is there a quick and clean way to make the plugin recognize that as the user-model?
    I ask this because after all the described configuration activities I get this error:

    Showing vendor/plugins/savage_beast/app/views/forums/index.html.erb where line #14 raised:

    uninitialized constant ActionView::Base::CompiledTemplates::User
    Extracted source (around line #14):

    11:
    12: ‘rss’) %>
    13: ,
    14: , “posts_count > 0”))==1 ? :voice_count : :voices_count, number_with_delimiter(count)] %>
    15:
    16:
    17:

  105. I implemented the admin? method in my application.rb (application controller) but it is not called when forums/index.html.erb is executed.
    I have included “SavageBeast::AuthenticationSystem” after the “helper: all” tag in the file.

    running Rails v 2.0.2
    Ruby 1.8.7

  106. @Arvind
    fixed the “Overriding methods of SavageBeast::AuthenticationSystem” by ACTUALLY overriding them in application_helper.rb !!!
    That’s the ONLY way I could get them to be loaded for the Savage Beast views to see them. Otherwise they kept going back to the SavageBeast::AuthenticationSystem methods.

  107. Hi All,

    I want to update the Savage Beast plugin for my rails 3.0.1
    application’s forum from rails 2.3.8, Is it available for Rails 3.0.1
    version or is there any plugin patch is available to update from rails
    2.3.8 to Rails 3.0.1 ?

    Thanks in Advance,
    Jak.

  108. Good post. I learn one thing tougher on totally different blogs everyday. It’s going to always be stimulating to learn content material from different writers and apply somewhat one thing from their store. I’d desire to make use of some with the content material on my weblog whether or not you don’t mind. Natually I’ll offer you a link in your internet blog. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *