Quantcast
Channel: rails – The Agile Warrior
Browsing latest articles
Browse All 48 View Live

Image may be NSFW.
Clik here to view.

How to model has two associations in rails

Say we want to model a transaction in rails between a buyer and seller which are represented as users in the system. How do you model that in activerecord? The short Basically we use the user model for...

View Article



Image may be NSFW.
Clik here to view.

How to create static pages Rails

> rails g controller StaticPages home help --no-test-framework config/routes.rb root 'static_pages#home' get "static_pages/home" get "static_pages/help" app/controllers/static_pages_controller.rb...

View Article

Image may be NSFW.
Clik here to view.

How to Install Capybara with RSpec Rails

Gemfile group :development, :test do gem 'sqlite3' gem 'rspec-rails', '2.13.1' end group :test do gem 'selenium-webdriver', '2.35.1' gem 'capybara', '2.1.0' end > bundle install > rails generate...

View Article

Image may be NSFW.
Clik here to view.

How to create User Rails

As summary of notes take from Michael Haretl’s excellent tutorial http://www.railstutorial.org/book/_single-page#cha-modeling_users Create User > rails generate scaffold User name:string...

View Article

Image may be NSFW.
Clik here to view.

How to Create Rails SignUp Page

Some notes from http://www.railstutorial.org/book/_single-page#cha-sign_up config/routes.rb match '/signup', to: 'users#new', via: 'get' end Gemfile group :test do gem 'selenium-webdriver', '2.35.1'...

View Article


Image may be NSFW.
Clik here to view.

rvm management workflow

Here are some notes to remind me how to setup and flip between various ruby configurations. Ruby setup > rvm list (current versions of ruby installed locally) > rvm list known (all known...

View Article

Image may be NSFW.
Clik here to view.

Rails generators cheat sheet

Cheat sheet for seeing what happens when you use rails generators. > rails g scaffold Foo foo_string:string foo_text:text foo_integer:integer foo_float:float foo_decimal:decimal...

View Article

Image may be NSFW.
Clik here to view.

Ruby hashes & symbols

Some notes from Michael Hartl’s excellent Rails tutorial on the differences between Hashes, Symbols, and others stuff. https://www.railstutorial.org/book/_single-page#sec-other_data_structures Hashes...

View Article


Image may be NSFW.
Clik here to view.

How to Rails nested layouts

Say you have several static but similarly designed web pages, but you don’t want to copy and paste all the same HTML again and again. Here is an example of two views, both static pages, the use nested...

View Article


Image may be NSFW.
Clik here to view.

How to add a flash message to your Rails Twitter Bootstrap application

To get these nice Twitter Bootstrap alerts to show up in your Rails application Emit them from your Rails app like this. SomeController  class SomeController < ApplicationController before_action...

View Article
Browsing latest articles
Browse All 48 View Live




Latest Images