1
votes

I am new to rails, I was working on my first rails app (http://guides.rubyonrails.org/getting_started.html) When i try to edit a latest post, I get an error because Patch method is not available in rails 3.2.16. Then I tried to use PUT method, But i got an error:

(wrong number of arguments (1 for 2)

I am trying to update gems using:

gem update

but it is giving error like this on many packages:

Updating rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.9.1
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build


Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

My current gem list :

actionmailer (3.2.16)
actionpack (3.2.16)
activemodel (4.2.3, 3.2.16)
activerecord (4.2.3, 3.2.16)
activeresource (4.0.0, 3.2.16)
activesupport (4.2.3, 4.2.0, 3.2.16)
arel (6.0.0, 3.0.3)
builder (3.2.2, 3.0.4)
coffee-rails (3.2.2)
coffee-script (2.4.1)
coffee-script-source (1.9.1.1)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.5.2)
hike (2.1.3, 1.2.3)
i18n (0.7.0)
journey (1.0.4)
jquery-rails (3.1.3)
json (1.8.3)
libv8 (3.16.14.11 x86_64-linux)
mail (2.6.3, 2.5.4)
mime-types (2.6.1, 1.25.1)
mini_portile (0.6.2)
minitest (5.7.0)
multi_json (1.11.2)
polyglot (0.3.5)
rack (1.6.4, 1.4.7)
rack-cache (1.2)
rack-ssl (1.4.1, 1.3.4)
rack-test (0.6.3)
rails (3.2.16)
rails-observers (0.1.2)
railties (3.2.16)
rake (10.4.2)
rdoc (4.2.0, 3.12.2)
ref (1.0.5)
rspec (3.3.0, 3.2.0)
rspec-core (3.3.1, 3.2.3)
rspec-expectations (3.3.0, 3.2.1)
rspec-mocks (3.3.1, 3.2.1)
rspec-support (3.3.0, 3.2.2)
sass (3.4.15)
sass-rails (3.2.6)
sprockets (3.2.0, 2.2.3)
sqlite3 (1.3.10)
strong_parameters (0.2.3)
therubyracer (0.12.2)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1, 1.4.1)
treetop (1.6.3, 1.4.15)
tzinfo (1.2.2, 0.3.44)
uglifier (2.7.1) 

Can anyone tell me a way to update rails (or every gem) to its latest version?

Current:

  • rails version : 3.2.16
  • ruby version : 1.9.3
  • gem version: 1.8.23
2
You should change the title of this question to be more specific about your problem.Max Williams

2 Answers

0
votes

No, its not possible to update every gem automatically without removing the version constraint.

If you have:

gem 'sass-rails', '~> 3.2' 

Then removing the version constraint:

gem 'sass-rails'

Would let you use bundle update to fetch the latest version. However this is rarely prudent to do since having explicit version requirements guarantees that your app does not unexpectedly break when updating unrelated gems or between different developers.

There are some rather large differences between Rails 3.2 and 4 and as a beginner rather than trying to go through the pitfalls of upgrading it may be easier for you install the latest version of Rails and create a new rails app.

0
votes

As mentiond in the output you posted there are some libraries missing which are needed. In your case zlib which again is necessary for buildung libxml2.

zlib is missing; necessary for building libxml2

So you have to install these missing libraries. For this I'm working on OS X with Homebrew as package manager and i find it very useful.

Also this link might help you with updating your application:

http://railsapps.github.io/updating-rails.html