Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
Debugger
g = -> (f, x) { f.call(x, 3) } | |
h = -> (x, y) { x + y } | |
g.call(h, 5) | |
>>8 | |
#same as this | |
geo = -> (zombi, gasparin) { zombi.call(gasparin, 3) } | |
jose = -> (gasparin, frankenstein) { gasparin + frankenstein } | |
geo.call(jose, 5) | |
>> 8 |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
puts 'hello world' |
class Employee | |
attr_accessor :name, :salary | |
def initialize(name, salary) | |
@name = name | |
@salary = salary.to_i | |
end | |
def start_salary |
class Car | |
attr_accessor :speed, :acceleration, :braking, :velocity | |
def initialize(velocity = 0) | |
@velocity = velocity | |
end | |
def accelerate(acceleration) | |
acceleration == 0 ? @velocity + 1 : @velocity + acceleration | |
end |
<h1>How remote true works</h1> | |
<%= form_tag remote: true do %> | |
<%= text_field_tag "name" %> | |
<%= submit_tag "sumit you name" %> | |
<% end %> | |
<div style="border: 1px red solid" id="names"> | |
<%= @names %> |
class Person | |
attr_reader :name | |
def initialize(name) | |
self.name = name | |
end | |
def name=(name) | |
if name == nil or name.size == 0 | |
raise ArgumentError.new('Must have a name.') | |
end |
.tiny-stone{ | |
width: 45px; | |
height: 45px; | |
position: relative; | |
margin: auto; | |
background: image-url('green-ubatuba.jpg'); | |
background-size: cover; | |
} |
#pending to comberted to more objec oriented....... |
class RoomsController < ApplicationController | |
def index | |
@rooms = Room.all | |
end | |
def show | |
@room = Room.find(params[:id]) | |
end | |
def new |