Rails database connection error trying to set up development environment - ruby-on-rails

I'm trying to get set up to make front-end changes to a Rails 2.3.3 app, and I cannot get the environment set up in a way the application will start up (with script/server). I'm using RVM to run Ruby 1.8.7 with Rails 2.3.3, but when I try to start the server I get the following error:
/Users/myusername/.rvm/gems/ruby-1.8.7-p334#rails233/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:55:uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
followed by the trail of filed to get there. Googling led me to add require 'thread' to boot.rb so my error changes to
/Users/myusername/.rvm/gems/ruby-1.8.7-p334#rails233/gems/postgres-pr-0.6.3/lib/postgres-pr/connection.rb:165:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
followed by the long trail of files it went through to get there. After Googling the error for a while, I think it has something to do with either my database.yml or some problem with actionmailer but I'm pretty much at a loss. I don't know if this is nearly enough information for anyone to help me but if you have any ideas just let me know. Also my list of gems is:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.8, 2.3.3)
actionpack (3.0.8, 2.3.3)
activemodel (3.0.8)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (3.0.8, 2.3.3)
arel (2.0.10)
builder (3.0.0, 2.1.2)
erubis (2.6.6)
faker (0.3.1)
i18n (0.6.0, 0.5.0)
mail (2.2.19)
mime-types (1.16)
polyglot (0.3.1)
postgres-pr (0.6.3)
rack (1.2.3, 1.0.1)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (2.3.3)
rake (0.8.7)
sqlite3 (1.3.3)
treetop (1.4.9)
tzinfo (0.3.27)
thanks for anything you can suggest!

That error has come up a couple times on me and as far as I know there isn't really a good solution. It comes from an incompatibility between rails 2.3.8 & lower and recent versions of ruby gems.
I suggest trying to use rails 2.3.11 or higher instead.
Refer to a previous question regarding this error:
Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

Related

Rails 2.3.8 I18n::UnknownFileType the file type yml is not known

i have an old rails project here running rails 2.3.8 and ruby 1.8.7 with rvm.
when i'm running rake -T or another rake task it will fail with
I18n::UnknownFileType: can not load translations from /home/project/trunk/vendor/rails/activesupport/lib/active_support/locale/en.yml, the file type yml is not known
running some YAML in the console, will work.
i found some solutions for rails 3 and ruby 1.9.3 (Rails 3: 'The file type yml is not known' when trying to access basic _form.html.erb) and rails 2.3 with ruby 2 (Rails legacy app and Ruby 2 error: can not load translations from the file type yml is not known) but didnt help.
my Gems used in this project:
actionmailer (2.3.18)
actionpack (2.3.18)
activerecord (2.3.18)
activeresource (2.3.18)
activesupport (2.3.18)
afm (0.2.2)
Ascii85 (1.0.2)
bundler-unload (1.0.2)
color (1.8)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hashery (2.1.1)
iconv (1.0.4)
little-plugger (1.1.4)
logging (2.0.0, 1.8.2)
multi_json (1.11.2)
mysql (2.9.1)
pdf-core (0.6.0)
pdf-reader (1.3.3)
pdf-writer (1.1.8)
prawn (2.0.2, 0.12.0)
rack (1.1.6)
rails (2.3.18)
rake (10.4.2, 10.1.1)
ruby-rc4 (0.1.5)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
transaction-simple (1.4.0.2)
ttfunk (1.4.0, 1.0.3)
script/console and script/server running fine.
i have to use ruby 1.8.7 and cannot update. upgrade to rails 3 is'nt possible in month's :)
do you have some idea's to get the rake tasks running?
best
robert
i found the solution:
there was several problems:
rake (10.4.2, 10.1.1) now just using rake 10.1.1
logging (2.0.0, 1.8.2) now just using logging 1.8.2
(after testing) had to replace rdoctask with task in Rakefile
now rake -T works fine

Redmine IMAP connection slow on Server 2003

Redmine 2.1.2 using a Thin service on Windows Server 2003
Great product, finally have it working after a few days of tinkering. The last stumbling block is the 'receive_imap'. I'm running manually from the command line and it seems to work (emails are being received and added to tickets) but the command never ends.
The ruby.exe process is still in task manager but never ends no matter how long I wait. If I kill the ruby.exe then the command line goes back to 'Terminate Batch Job Y/n'.
Command is:
rake -f D:\Redmine\Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=mail username=user#server.com.au password=password
Adding '--trace' to the end shows nothing interesting, just gets to '**Execute redmine:email:receive_imap'.
Strange though that it does succeed in bringing the emails in!
I left the process running over the weekend and it seems to have ended at some point. I pushed enter at the command line and it went back to the prompt.
It seems that the process will end after about 30 minutes if I let it go.
When I run the rake command, within about 15 seconds the mailbox is checked and updates to the issues are logged, but after that the process is just sitting there doing nothing.
Is there any additional logging I can enable to see what the issue is? The production.log doesn't show much and the mail server just sees the connect etc.
Watching the IMAP connections in Exchange System Manager the actual IMAP connection is still connected for the entire time the process is going.
UPDATE:
I've just set up a Bitnami stack in a VM and ran the same command, it runs in seconds and the emails are imported straight away... so it's def not an Exchange issue. I'm struggling to see what the difference could be!
I can telnet to the mail server on port 143 so it's not the firewall. I've also installed the 1.8.7 version of Ruby and used 'pik' to switch to it before running the rake command and still the same issue.
I'm really struggling here as this is the only feature stopping us from going live now!
Anyone have any ideas?
Thanks in advance!
Details:
ruby -v:
ruby 1.9.3p286 (2012-10-12) [i386-mingw32]
Rails -v:
Rails 3.2.8
gem list:
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
acts-as-taggable-on (2.3.3)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.4, 3.0.0)
bundler (1.2.1)
coderay (1.0.8)
daemons (1.1.9)
erubis (2.7.0)
eventmachine (1.0.0.rc.4 x86-mingw32)
hike (1.2.1)
i18n (0.6.1)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.7.5, 1.5.4)
mail (2.4.4)
mime-types (1.19)
minitest (2.5.1)
multi_json (1.3.6)
mysql2 (0.3.11 x86-mingw32)
net-ldap (0.3.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12, 3.9.4)
ruby-openid (2.1.8)
sprockets (2.1.3)
thin (1.5.0)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.11)
tzinfo (0.3.34, 0.3.33)
ya2yaml (0.31)
I had the same problem of you.
My solution isn’t the ideal, but works.
I added the command above at the end of method check on the file apps\redmine\htdocs\lib\redmine\imap.rb:
Process.exit!(true)
I have helped.

Kindly suggest appropriate Attachment plugin/gem for use with Rails 2.0.2 and Ruby 1.8.7

I am trying to attach files in my RoR app. I am using Rails 2.0.2 and Ruby 1.8.7 for project specific purposes. I am using Ubuntu 10.04 OS.
I have tried out two plugins(paperclip and attachment_fu) but I have no luck so far in getting things working with them. I am basically facing compatibility issues as the configuration I am using is pretty much not used these days.
Kindly have a look at these URL'S in order to better understand the issues that I am currently facing:-
Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7
https://stackoverflow.com/questions/6000588/issues-with-attachment-fu-plugin-in-rails-2
It would be great if you can help me with your insights on these issues.
Also, can you kindly suggest plugins or gems which I can make use of to attach files in my rails app based on the above configuration.
[EDITED QUESTION]
I also would like to add I tried out paperclip 2.1.2 gem but it doesn't seem to get detected through IRB. I don't know how much of a difference this information will make, but I would like to add that I am also making use of RVM and having another ruby 1.9.2 with me.
although paperclip gem is installed and shows up in my ruby gems list , I wonder why I get a null( '[]' ) when I do a require 'paperclip' through IRB.
mohnish#mohnish-desktop:~/UP/pocs_tried_for_use/post_with_image$ gem list
*** LOCAL GEMS ***
aasm (2.2.0, 2.1.1)
action_profiler (1.0.0)
actionmailer (2.3.5, 2.0.2)
actionpack (2.3.5, 2.0.2)
activerecord (2.3.5, 2.0.2)
activeresource (2.3.5, 2.0.2)
activesupport (3.0.0, 2.3.5, 2.0.2)
acts_as_reportable (1.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.1)
contacts (1.2.4)
daemons (1.1.0)
fastercsv (1.5.3)
fastthread (1.0.7)
ferret (0.11.6)
gdata (1.1.1)
gem_plugin (0.2.3)
gettext (2.1.0)
hoe (2.6.2)
hpricot (0.8.3, 0.8.2)
httpclient (2.1.5.2)
image_science (1.2.1)
json (1.4.6)
json_pure (1.4.6)
locale (2.0.5)
log4r (1.1.8)
macaddr (1.0.0)
mechanize (1.0.0)
memcache-client (1.8.5)
mime-types (1.16)
mocha (0.9.8)
mongrel (1.1.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
paperclip (2.1.2)
passenger (2.2.4)
pdf-writer (1.1.8)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
rack (1.0.1)
railroad (0.5.0)
rails (2.0.2)
rake (0.8.7)
RedCloth (3.0.3)
rfacebook (0.9.8, 0.9.0)
rmagick (2.9.1)
ruby-activeldap (0.8.3.1)
ruby-net-ldap (0.0.4)
ruby-openid (2.1.8, 2.0.2)
rubyforge (2.0.4)
rubygems-update (1.3.7)
ruport (1.6.3)
scrubyt (0.4.06)
tinyurl (1.0.0)
transaction-simple (1.4.0)
uuid (2.3.1)
xml-simple (1.0.12)
mohnish#mohnish-desktop:~/pocs_tried_for_use/post_with_image$ ruby script/console
Loading development environment (Rails 2.0.2)
ruby-1.8.7-p334 :001 > require 'paperclip'
=> []
ruby-1.8.7-p334 :002 >
Your suggestions would be really helpful,
Thank you..
If you're using a significantly older version of Rails you may be exposing yourself to serious security vulnerabilities, so if you can upgrade, you really should, even if it's just to another point release in the 2.0.x series.
That being said, you could always install a version of paperclip that's from that era. Newer versions only support 2.3 or better as far as I know.
Any project that's hosted on github will have a full version history so you can rewind the project to a particular revision that works for you. The git bisect tool is great for handling this sort of thing.

Ruby on Rail gem install activerecord-sqlserver-adapter error

I'm trying to run rake commands on my local SQL server database using ODBC. I have setup the ODBC connections and thought I had the rails end covered however, i'm running into this error.
Please install the sqlserver adapter: gem install activerecord-sqlserver-adapter (no such file to load -- active_record/connection_adapters/sqlserver_adapter)
I have the following gems installed:
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (3.0.5)
activemodel (3.0.5)
activerecord (3.0.5, 1.15.6)
activerecord-sqlserver-adapter (3.0.10)
activeresource (3.0.5)
activesupport (3.0.5, 1.4.4)
arel (2.0.9)
builder (3.0.0, 2.1.2)
bundler (1.0.10)
dbd-odbc (0.2.4)
dbi (0.4.1)
deprecated (3.0.0, 2.0.1)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.15)
mime-types (1.16)
minitest (2.0.2, 1.6.0)
odbc-rails (1.5)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.7.1, 0.6.14)
rack-test (0.5.7)
rails (3.0.5)
railties (3.0.5)
rake (0.8.7)
rdoc (3.5.3, 2.5.8)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.25)
Am I missing a gem? What else do I need to get this running on my windows box?
Thanks in advance for any help :-)
Try to add such line in your %APP_ROOT%/Gemfile
gem 'activerecord-sqlserver-adapter'
Also, your way behind on the times. First the DBI/DBD-ODBC were removed from the adapter stack about a year ago. Also, the easiest way (and best performance) is to use TinyTDS for the connection mode. See there wiki here.
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds

Using Gems with Ruby On Rails: Undefined method?

There's this snazzy captcha that asks questions rather than displaying pictures. You can read about it at textcaptcha.com. Anyway. I want to use that with Ruby on Rails. A developer by the name of Matt Hutchinson wrote a Gem for easily connecting to the API. He has a set of instructions next to his source files on github. Anyway, It looks pretty simple but in trying to implement it I get this error every time:
undefined method `acts_as_textcaptcha' for #<Class:0x104098508>
Rails.root: /Users/cory/Documents/Learning/RoR/dpt
Application Trace | Framework Trace | Full Trace
app/models/citation.rb:20
app/controllers/citations_controller.rb:29:in `new'
The root of my question has a bit less to do with this specific gem, and a little more with how gems work. I've installed the gem, and then bundled it inside of my rails app, it should be accessible (as I understand it). I see references to the gem in the gemfile.rb and the gemfile.lock, but again and again it tells me I'm using and undefined method.
The gem should be defining the method for me, should it not? Or is there something that I manually have to do?
Just let me know if there is any other info that would be helpful, thanks!
Well, jeez. It's working now. It could be that I restarted the server, but I'm not positive. What I did was installed RubyMine to see if I could use it's debugger, in doing so it required that I run the bundle install (it chose some different versions of some dependancies) through there, and also stop my other webrick server, to run the one through the RubyMine console. I did so, it gave me errors, when when I went back to my other installer it worked!?
Anyway, I've got my question resolved, but in the event that anyone looks this up, these are my current gems:
$ bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.0)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.0)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.0)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.0)
Using arel (1.0.1)
Using activerecord (3.0.0)
Using activeresource (3.0.0)
Using bcrypt-ruby (2.1.4)
Using acts_as_textcaptcha (2.2.0)
Using bundler (1.0.10)
Using thor (0.14.6)
Using railties (3.0.0)
Using rails (3.0.0)
Using sqlite3-ruby (1.2.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Thanks all!
But if you are trying this, do try restarting the server first as suggested, I wish I knew if that would have worked :D

Resources