Rails SequencedHash source file - ruby-on-rails

I am testing AlumniOnRails (http://rubyforge.org/frs/?group_id=2959&release_id=17170) which is based on Rails 1.2.6 (I know it's outdated) and managed to get it up, installed the required gems, created and migrated the data and most of the basic alumni functionalities are up but one, the part that is broken seems to be missing a library and yet I can't seem to find it after a few reasonable searches.
The logger shows no such file to load -- collections/sequenced_hash with a line within the controller having the code of require 'collections/sequenced_hash which is quite obvious that the sequence_hash library is missing.
A few searches on Google shows a few references, one with the closest pointer is http://collections.rubyforge.org/classes/SequencedHash.html but unfortuntely the source link is dead. Does anyone keep this kind of old file or point me to somewhere it is? Thank you

Somebody answered this over ruby forum and it works:
gem install collections

Related

/usr/bin/ruby file just contains gibberish and the word 'ELF'; safe to delete this/is this the file I really need?

I'm trying to install the Ruby gem foreverb, to keep my server process running when SSH disconnects, and also for improved understanding of the people visiting my site.
On following this guide:
https://github.com/DAddYE/foreverb
It mentioned to write some code in /usr/bin/ruby so I dutifully opened the file and looked inside. Instead of what I expected (either a blank file or something that looks like Ruby code) I was instead greeted with this:
^?ELF^B^A^A^#^#^#^#^#^#^#^#^#^C^#>^#^A^#^#^#à^H^#^#^#^#^#^##^#^#^#^#^#^#^#^P^Q^#^#^#^#^#^#^#^#^#^##^#8^# ^##^#^[^#^Z^#^F^#^#^#^E^#^#^##^#^#^#^#^#^#^##^#^#^#^#^#^#^##^#^#^#^#^#^#^#ø^A^#^#^#^#^#^#ø^A^#^#^#^#^#^#^H^#^#^#^#^#^#^#^C^#^#^#^D^#^#^#8^B^#^#^#^#^#^#8^B^#^#^#^#^#^#8^B^#^#^#^#^#^#^\^#^#^#^#^#^#^#^\^#^#^#^#^#^#^#^A^#^#^#^#^#^#^#^A^#^#^#^E^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#¼^K^#^#^#^#^#^#¼^K^#^#^#^#^#^#^#^# ^#^#^#^#^#^A^#^#^#^F^#^#^# ^M^#^#^#^#^#^# ^M ^#^#^#^#^# ^M ^#^#^#^#^#p^B^#^#^#^#^#^#x^B^#^#^#^#^#^#^#^# ^#^#^#^#^#^B^#^#^#^F^#^#^#¸^M^#^#^#^#^#^#¸^M ^#^#^#^#^#¸^M ^#^#^#^#^#Ð^A^#^#^#^#^#^#Ð^A^#^#^#^#^#^#^H^#^#^#^#^#^#^#^D^#^#^#^D^#^#^#T^B^#^#^#^#^#^#T^B^#^#^#^#^#^#T^B^#^#^#^#^#^#D^#^#^#^#^#^#^#D^#^#^#^#^#^#^#^D^#^#^#^#^#^#^#Påtd^D^#^#^#<98>
^#^#^#^#^#^#<98>
^#^#^#^#^#^#<98>
Not entirely sure what it is, but pretty sure it shouldn't be there. Is it file corruption, as it doesn't look like what I'd generally consider to be file corruption? While I assume it's probably not doing anything useful at the moment, does the presence of semi-arbirary strings in this file represent a problem with my Ruby installation which I need to fix? Is there perhaps another location or set of locations where the right file might be, and perhaps this one isn't being used?
I notice I have a lot of problems with my server, and often find I have to randomly reinstall gems which seem to disappear from my system, usually after the SSH disconnects. Could this file be something to do with that?
It seems odd to me that if this is the location of an important Ruby system file that my Ruby installation should work at all, but it does seem to... Might it be left over from a previously broken installation? I'm only just progressing out of the beginner stages with Ruby, so any insight into what the file does, why it's important and, particularly, how I should progress would be extremely helpful. Also, any suggestions for further reading on Ruby framework eco system which might help me better understand the inner working of stuff like this would hopefully save me from having to take up people's time here with similar questions in the future, though I understand that's a little outside the usual remit for the site.

How to convert a large gem to standalone rails app

I'm building a social network and have been using the gem community_engine but have been having trouble implementing the large amount of customization that I need for my app. I figure this will make it easier for me to override and add methods, as well as help me to better understand and learn from the code since I will be able to actually see all of it in action.
So far in my attempt I downloaded the source code, added the default bin directory and config files that were missing, as well ass all the gem dependencies.
What else do I need to do to get the app to work? I realize that there may still be a lot and that it might not be easy to explain, but at the very least is there any sort of documentation out there that might help me understand how to convert the gem to a Rails application?
Heres the community_engine repo: https://github.com/bborn/communityengine
Because this idea may draw some criticism, I'll add that I was originally building the app without any huge plugins accept for devise however I'm running out of time to finish this.
More stuff I've tried:
Moving files to a new rails app, got server to run but encountered many seemingly random errors, fixed a few but more just seem to pop up that I cant figure out:
I also took a look at http://guides.rubyonrails.org/plugins.html but this gem seems to go beyond that.
I would suggest that you clone the gem and begin copying files from the gem into your a new Rails application.
The engine gem probably has a similar structure to a Rails application, so you should be able to move the files from the corresponding folder to the same folder in your Rails root folder.
You may need to move gem files out of modules, change namespaces etc. Relevant folders to look at files you'll want to include might include app/ config/ db/, any gem dependencies in Gemfile or the gemspec file, as well as spec/ or test/.
Beyond that I think there's no silver bullet answer to your question, you're just going to have to work through problems until you have this up and running, and perhaps ask subsequent questions if you hit on an obstacle that you don't get beyond.
I think what you're looking for is a way to hook your Rails Engine into a rails app. The Hooking Into an Application section of the Getting Started with Rails Engines guide should be exactly what you're looking for.
Here are two additional resources on Rails Engines.
A Guide to Rails Engines in the Wild
Rails::Engine - Ruby on Rails API

Plugin vs Engine in Rails 3, shipped as a gem

In the documentation for Rails::Plugin (for Rails 3), I'm reading the following:
"... you actually cannot declare a Rails::Engine inside your Plugin, otherwise it would cause the same files to be loaded twice. This means that if you want to ship an Engine as gem it cannot be used as plugin and vice-versa."
Can anyone be more specific about exactly what files get loaded twice? I have declared a plugin/gem as Engine, and it works fine also being put inside vendor/plugins (and I'd like to keep it this way), in spite of the statement above. I simply want some clarity on why (and whether) this is not a good thing to do.
Thank you!
I don't have an exact answer myself, but this subject is covered in this resource which I have found helpful:
https://gist.github.com/e139fa787aa882c0aa9c

Creating a basic facebook application with Rails

I am creating a simple facebook application using Ruby on rails and I am following the liveRail tutorial available here
http://www.liverail.net/articles/2007/6/29/tutorial-on-developing-a-facebook-platform-application-with-ruby-on-rails
The problem that Im facing is that when I launch my server it throws an error saying that it cant find the 'gem_original_require' : no such file to load facebook_rails_controller_extensions.
I have added the rfacebook gem but the error is thrown when i include the require
require "facebook_rails_controller_extensions" in the environment.rb file.
Im not completely sure whether this is the right way to go with Rails 2 but I've between making changes when i find relevant information for Rails 2
I would appreciate any suggestions on this or any links to other tutorials too.
Thank you
That tutorial is SEVERELY out-of-date and you're going to have lots of issues if you keep following it. rFacebook hasn't be actively maintained in a good 2 years. You should be using Facebooker.
There is a good facebooker tutorial here: http://apps.facebook.com/facebooker_tutorial/
Examine your $LOAD_PATH variable.
It's a common issue that your load path doesn't contain library.
Use $LOAD_PATH<<'/usr/lib/superrubylib' to add a path to load.
Uh, and it seems to be a best practice to use require File.dirname(__FILE__) + "/../relative/path" to set up relative paths.
P.S. Please, specify more data about paths and locations to let us answer your question specifically.

rails ruby-prof and benchmark testing

I'm running Rails 2.2.2. I've read a few articles about ruby-prof and profiling a rails app. And I'm confused as to how things are really working.
I was originally using this tutorial
http://snippets.aktagon.com/snippets/255-How-to-profile-your-Rails-and-Ruby-applications-with-ruby-prof
to profile my app, and it works. This involves writing your own profile environment and running > RAILS_ENV=profiling ./script/performance/request -n 100 profiling/homepage.rb
So here's my confusion. Somehow, this runs ruby-prof and opens up all the stats etc, but I can't see anywhere where ruby-prof is ever actually called.
So then I read further, and it seems 2.2.2 has benchmarking/profiling built in. So I write a test file in the performance section like so
require 'test_helper'
require 'performance_test_help'
# Profiling results for each test method are written to tmp/performance.
class BrowsingTest < ActionController::PerformanceTest
def test_worksheet
get '/reduction/worksheet'
end
end
and run
rake test:profile
Is this equivalent to what I was doing above, but just now it's integrated into the whole rails framework?
My next question is this. The original script ouput a flat file and html file, but I couldn't figure out how to also get a tree file automatically to open up with KCacheGrind, or in my case MacCallGrind. Can I add formats into my script call?
Edit: running the scripts through rake test seem to actually produce a tree file, great. Mac CallGrind however seems to hang when trying to parse it. Anyone know other tools for viewing these tree files?
Turns out, it's exactly the same, I must have been reading an old tutorial. All the benchmarking and profiling is now in Rails which is awesome. And it outputs txt,html and tree files, also awesome. Now if Only MacCallGrind would work, there's no way I'm installing the 4gb of KDE packages needed just to view a tree file.
Brad, you should contact the author of MacCallGrind and see if there's an update, or whether he/she has a fix for your files.
Oh that's right, that's me. Please email at richard at symbol aggmedia.net, as there is an update about to come out, and I'd love to have Ruby/Rails support available.

Resources