Skip to content

Instantly share code, notes, and snippets.

@Judit
Created September 20, 2010 10:44
Show Gist options
  • Save Judit/587724 to your computer and use it in GitHub Desktop.
Save Judit/587724 to your computer and use it in GitHub Desktop.
Rails 3 steps
* Install rvm
http://rvm.beginrescueend.com/rvm/install/
* Prepare the development environment update rvm whit ruby 1.9.2 and rails 3.0.0:
rvm update && rvm reload # update rvm
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm --default 1.9.2@rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
-----------------------------------------------------------------------------------
* Install postgres
apt-get install postgresql
Use apt-file to resolve any library unknown file dependences
* Add user and create postgres databases
sudo su postgres
createuser --pwprompt (Introduce the user/pass for the app and set superuser = y)
createdb -E UTF8 -O <user> <db>
For BRMP:
createdb -E UTF8 -O biocomfort_rmp biocomfort_rmp_test
createdb -E UTF8 -O biocomfort_rmp biocomfort_rmp_development
exit
--------------------------------------------------------------------------------
* Install the app:
bundle install
rake db:migrate
Tutorial: http://github.com/binarylogic/authlogic_example
For run authlogic generator, first you must write the next line in the Gemfile:
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
Then, run: rails g authlogic:session user_session
Routing in Rails 3, for authlogic:
match 'logout' => 'user_sessions#destroy', :as => :logout
resource :user_session
resource :account, :controller => "users"
resources :users
root :to => "user_sessions#new"
In application.rb:
config.filter_parameters += [:password, :password_confirmation]
Install plugin 'dynamic_form' to support error_messages
Delete public/index.html
Cancan: http://github.com/ryanb/cancan/wiki/role-based-authorization
Gemfile:
group :development, :test do
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'launchy' # So you can do Then show me the page
gem 'factory_girl_rails'
gem 'shoulda'
gem 'faker'
gem 'escape_utils' # to fix the warning 'regexp match /.../n against to UTF-8 string' while executing cucumber
end
$ bundle install
To generate cucumber whit spanish steps:
ruby script/rails generate cucumber:install es --capybara --testunit
Gemfile
gem 'pickle'
$ bundle install
$ rails g pickle
features/suppor/factory_girl.rb
require 'factory_girl'
Dir[File.dirname(__FILE__) + '/test/factories/*.rb'].each {|file| require file }
features/suppor/pickle.rb
require 'pickle/world'
Pickle.configure do |config|
config.adapters = [:factory_girl]
config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
end
Gemfile:
gem 'formtastic', '~> 1.1.0'
gem 'haml-rails'
$ bundle install
$ rails generate formtastic:install
* http://github.com/rails/jquery-ujs
0. Remove all prototype files from public/javascript
1. Download jQuery from docs.jquery.com/Downloading_jQuery and put the file in public/javascripts
2. Copy rails.js from github.com/rails/jquery-ujs/raw/master/src/rails.js into public/javascripts - overwriting the prototype one
* In the application layout, include:
= javascript_include_tag "jquery", "rails", "application"
* Rails 3, UJS, and CSRF Meta Tags (http://www.themodestrubyist.com/2010/02/24/rails-3-ujs-and-csrf-meta-tags/)
= csrf_meta_tag
http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/
http://github.com/matthooks/authlogic-activation-tutorial
http://www.claytonlz.com/index.php/2009/07/authlogic-account-activation-tutorial/
http://edgeguides.rubyonrails.org/action_mailer_basics.html
http://github.com/rejeep/authlogic-password-reset-tutorial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment