Thursday, January 15, 2015

Error installing rb-gsl gem on ubuntu

While installing rb-gsl gem on my gemset from ruby 2.1.0 got an error trailed like below

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/praveen/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20150115-4389-1qh8ghv.rb extconf.rb
extconf.rb:6: warning: Insecure world writable dir /opt/android-sdk in PATH, mode 040777
*** ERROR: missing required library to compile this module: No such file or directory - gsl-config
*** 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=/home/praveen/.rvm/rubies/ruby-2.1.5/bin/ruby
    --with-gsl-version

extconf failed, exit code 1

Gem files will remain installed in /home/praveen/.rvm/gems/ruby-2.1.5/gems/rb-gsl-1.16.0.2 for inspection.
Results logged to /home/praveen/.rvm/gems/ruby-2.1.5/extensions/x86_64-linux/2.1.0/rb-gsl-1.16.0.2/gem_make.out


there is one system dependency that is required to pursue further in ubuntu install libgsl0-dev package, install it like..
sudo apt-get install libgsl0-dev
That's it now retry installing rb-gsl gem.. it worked for me :)





Monday, January 5, 2015

How to access rails application routes in rails models

With the newer version of rails, application itself is an engine which is the initialized format of abstract class Rails::Application and to access routes of any (host) engine the code is

SomeRailsApplicationName::Application.routes.url_helpers.named_route_path
SomeRailsApplicationName::Application.routes.url_helpers.named_route_path(parameter: 'something')

and for a (mountable) engine the code is

SomeMountableEngineName::Engine.routes.url_helpers.named_route_path
SomeMountableEngineName::Engine.routes.url_helpers.named_route_path(parameter: 'something'

Example:

rails console > Helloworld::Application.routes.url_helpers.about_path
 => "/about"

rails console > BambooUser::Engine.routes.url_helpers.login_path
 => "/users/login"

Honda Civic & A/C problems.

Hello Friends, Got a post again on to Honda Civic (The good old favorite commuter of mine). This car has been doing great except for so...