Monthly Archives: December 2014

The program ‘bundle’ is currently not installed

This is a common problem when you first time install a new version of ruby. To fix this problem please follow below steps:

Step one:
Set up the PATH variable for the installed ruby executable
(Suppose the installed ruby is ruby-2.1.5):

Step two:

PATH=$PATH:$HOME/.rvm/gems/ruby-2.1.5/bin

Step three:

gem install bundler

(if bundler is not installed)

Final Step:

rvm use ruby-2.1.5 --default

(–default is optional).

This will fix your problem.

Hope it helps 🙂

Advertisements

Remove model field name in rails validation

By default rails show field name before it’s default message.

For example default rails validation:

validates_xxx_of :the_column, :message => "Please add this!" will show message "The ColumnPlease add this!"

For project purposes we need some time to add custom error messages without a field name in rails validation.

We can solve this by adding custom method in model.

In rails 2: you can do on your model:

validate :test_validation

private

def test_validation
errors.add_to_base("Message")
end

In rails 3 or greater:

validate :test_validation

private

def test_validation
errors.add(:base, 'Message')
end