composite_primary_keys rails server fail to start

136 views
Skip to first unread message

Shailendra Jain

unread,
May 11, 2014, 11:11:21 PM5/11/14
to compos...@googlegroups.com
Hi,

  I am using legacy database which has composite key.

  So I added  the line  "gem 'composite_primary_keys', '=3.1.0'" in Gemfile and issued bundle install.

  Also I added the line - "require composite_primary_keys" in config/environment.rb

  But when I started the rails server I got the below error -

bin/rails:6: warning: already initialized constant APP_PATH
/home/samanth/Sites/eodd2/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.

Can someone let me know what could be the issue?

Thanks,
Shailendra

Shailendra Jain

unread,
May 12, 2014, 9:16:13 PM5/12/14
to compos...@googlegroups.com
I tried using the solution suggested at 

===> 
The problem is fixed in the ar_4.1.x branch of the gem's source code, however. If your project uses Bundler, a solution is to edit its Gemfile and replace the line
gem 'composite_primary_keys'

with

gem 'composite_primary_keys', {
  :git => 'git://github.com/composite-primary-keys/composite_primary_keys.git',
  :branch => 'ar_4.1.x'
}
====>

But no luck and with the above change, I got the below error-

$ bundle update
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "activerecord":
  In Gemfile:
    rails (= 4.1.0) ruby depends on
      activerecord (= 4.1.0) ruby

    composite_primary_keys (>= 0) ruby depends on
      activerecord (4.1.0.rc2)

Please advise how to go from here ?

Thanks,
Shailendra
Reply all
Reply to author
Forward
0 new messages