rails 4.1: styling an app with bootstrap and font-awesome

Install the bootstrap gem: gem “bootstrap-sass”, “~> 3.3” gem “font-awesome-rails”, “~> 4.3” Rename app/assets/stylesheets/application.css to application.css.scss, so you an add @import statements to it Replace the entire content of the file with: @import “bootstrap-sprockets”; @import “bootstrap”; @import “font-awesome”; Once you do this, you will need to also import the particular stylesheets your app is compose […]

rails 4.1 helpers

helpers are methods inside your app/helpers folder, and they are available to your views usage. Every controller gets one (if the controller gets created via a generator). Example of an application helper: module ApplicationHelper def title(*parts) unless parts.empty? content_for :title do (parts << “Ticketee”).join(” – “) end end end end The * means any argument passed […]

rails 4.1: creating a CRUD resource feature

Create the test first, inside your specs/feature/ folder: spec/features/your_feature_name_spec.rb Sample content for that file: require “rails_helper” RSpec.feature “Users can create a project” do scenario “with valid attributes” do visit “/” click_link “New Project” fill_in “Name”, with: “Some Project name” fill_in “Description”, with: “Some project description” click_button “Create” expect(page).to have_content “Project has been created.” end end […]

rails projects workflow

setup your rails vagrant env and add git, by following the instructions in this page setup your IDE to be connected to your vagrant instance (inside Vagrantfile): config.vm.synced_folder “./src”, “/home/vagrant/your_project” setup the initial rails app: rails new myapp setup the bitbucket repo config and initialize your git repo: git config –global user.name “your name” git […]