Langsung ke konten utama

Postingan

Menampilkan postingan dari Maret, 2012

ruby on rails devise skip validation of password, when edit user in user form

If you want to skip password validation in devise login. In users controller, you only add line below:


sign_in @user, :bypass => true unless params[:user][:password].blank?

for example:
def update
    if @user.update_user_data(params[:user])
      sign_in @user, :bypass => true unless params[:user][:password].blank?
      if current_user.is_admin?
        redirect_to users_path
      else
        redirect_to edit_user_path(current_user)
      end
    else
      render :action => :edit
    end
  end



rails 3 Installing pg (0.11.0) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!

Installing pg (0.11.0) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks! /home/lap048/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /home/lap048/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.1.2/bin/pg_config Using config values from /usr/local/Cellar/postgresql/9.1.2/bin/pg_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 --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-l…

Ubuntu 10.10 how to install netbeans for rub on rails

Install netbeans for ruby on rails di ubuntu 10.10
1. http://netbeans.org/downloads/6.9.1/
2. Download netbeans for ruby
3. In terminal you should to go to the directory after you finished to download. for example: cd home/your_computer/Downloads
4. sudo apt-get install openjdk-6-jdk
5. sudo sh  ./netbeans-6.9.1-ml-javase-linux.sh
6. finish.