Tuesday, July 23, 2024
HomeRuby On RailsIdeas and Tips | Drifting Ruby

Ideas and Tips | Drifting Ruby


<%= link_to undertaking %>
# mannequin
def to_s
  title
finish

def to_s = title
# Rails Console

Undertaking.discover(1).current?
Undertaking.exists?(id: 1)
Undertaking.the place(id: 1).any?
# Terminal
rails g controller admin/welcomes present
# app/views/layouts/admin/welcomes.html.erb
<content material>
# view
<%= some_svg(800, 150) %>
# helper
def some_svg(width=150, peak=150)
  <<-HEREDOC.html_safe
    <svg width="#{width}" peak="#{peak}" xmlns="http://www.w3.org/2000/svg">
      <rect width="#{width}" peak="#{peak}" x="0" y="0" model="fill:blue;stroke:pink;stroke-width:5;opacity:0.5" />
    </svg>
  HEREDOC
finish
# Terminal
bundle open gem_name
# Terminal
ruby -run -ehttpd -- --port 3000

code ~/.zshrc
supply ~/.zshrc

serve 3000
# ~/.zshrc
serve () {
  ruby -run -ehttpd -- --port $1
}
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments