Topic: Running Old Rails App

Hi,


I am very new to rails.
Have old rails application assigned to me
Installed Net beans.
How to recreate the database.

Need help...

Thanks,
Rabin.

Re: Running Old Rails App

1 - check Rails version used for the application (either in Gemfile or in config/environment.rb file if Rails vesrion < 3.*).
2- Configure your environment (by downloading needed gems either manually or by running bundler).
3 - run from your terminal or console:

#to create a database
rake db:create

to run all the migartions
rake db:migrate

See more details on Rails guides
for rails3.*: http://guides.rubyonrails.org/
for rails < 3.0: http://guides.rubyonrails.org/v2.3.11/

Hope this helps.

Last edited by Javix (2012-07-24 06:06:59)

Re: Running Old Rails App

Thanks for the reply...Environment.rb look like this .... but version is not mentioned
<code>

# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
#RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.

  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )

  # Specify gems that this application depends on and have them installed with rake gems:install
  # config.gem "bj"
  # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
  # config.gem "sqlite3-ruby", :lib => "sqlite3"
  # config.gem "aws-s3", :lib => "aws/s3"

  # Only load the plugins named here, in the order given (default is alphabetical).
  # :all can be used as a placeholder for all plugins not explicitly named
  # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

  # Skip frameworks you're not going to use. To use Rails without a database,
  # you must remove the Active Record framework.
  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  # Run "rake -D time" for a list of tasks for finding time zone names.
  #config.time_zone = 'UTC'

  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
  # config.i18n.default_locale = :de
end

</code>

Last edited by rabinprithvi (2012-07-24 06:54:00)

Re: Running Old Rails App

Actually, I want to run the app and see what it looks like,

I have only the source  and nothing else

Project Details - Rails 2.3.10 , MySQL server

I have just started learning rails and MySQL

What It takes to run the existing project

Any help would be useful

Thanks,
rabin.

Re: Running Old Rails App

According to your environment.rb file your app uses 2.3.4 version:

RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

And you hav 2.3.10. So to be able to run the app, you should either to install the exact rails version used by it (2.3.4 in your case) or try to modify it to yours one (instead of 2.3.4 type in 2.3.10).
After you get your environmeent set up, just run migration as I explained earlier.
If everything is OK, you can run the server:

$ script/server
#or on Windows
c:/your_app_folder/> ruby script/server

You can find all the details at Rails 2.3.11 Guides
And the correct tags to post your code snippest is

code and /code surrounded with brackets.

Last edited by Javix (2012-07-24 15:34:47)

Re: Running Old Rails App

Thanks Javix...

After getting tired with this old project ... I have switched to another old rails project to try my luck there

But this time  , greeted with different errors

When I run ruby script/server, I am informed to install missing gems

When I run........ rake gems:install

I get following error


can't activate activerecord (>= 3.0.3, runtime) for ["thinking-sphinx-2.0.12"], already activated activerecord-2.3.10 for ["rails-2.3.10"]
/home/username/path/rails/myproject/Rakefile:12
(See full trace by running task with --trace)

I am tired of rails....... why is it so difficult even to run a project .... forget Hello World !

Any help ?

Thanks,
Rabin.

Re: Running Old Rails App

Rails is not difficult at all compared with Java for example. The problem is that there is a GREAT difference between rails 2.3* and 3.0 versions done in project structure and how the things are linked together.
- Try first to configure your environment to use Rails 2.3.* version as I explained earlier (install all minimal needed gems to create a Rails application)
- Check if everything works fine by creating a simple RoR project using the same DB adapter as you project does.
- Then try step by step to identify your project configuration problem.

As you know, there is a gem runtime dependency, so try to check it for every gem used by your project by going to http://www.rubygems.org and finding the needed gem. Every time, once a gem found, you can see its runtime dependencies; So just try to install them.
Sure it is enough tedious. I agree that it was more difficult at that time to manage gems used by a project; Now thanks to bundler it is more easy. like with Maven tool in Java world.

Re: Running Old Rails App

Thanks Javix...second project is working now.
Followed your advice....gained confidence after running a sample ROR project.
Nice to see someone helping me.
Thanks a lot dude.

I will try to run the first project in a few days...

By the way what is the difference between rake task and bundle install

Thanks.
Rabin

Last edited by rabinprithvi (2012-07-27 02:40:00)