This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show do | order | | |
attributes_table do | |
items = OrderItem.where("order_id=?", order.id) | |
row :id | |
row :user_id do | |
user = User.find(order.user_id) | |
link_to("#{user.first_name} #{user.last_name}", admin_user_path(order.user_id)) | |
end | |
row "ORDER ITEMS" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: elasticsearch | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Starts elasticsearch | |
# Description: Starts elasticsearch using start-stop-daemon | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Printer < ActiveRecord::Base | |
belongs_to :manufacturer | |
has_many :printer_cartridges | |
has_many :cartridges, :through => :printer_cartridges | |
attr_accessible :name, :id, :manufacturer_id | |
attr_accessor :manufacturer, :group, :page, :pages, :per_page, :total | |
def initialize(args = {}) | |
super |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic example how to create an import from csv data. This could | |
# be called in a rake task: | |
namespace :db do | |
namespace :import do | |
desc "Import customer of old shop from csv" | |
task :customer => :environment do | |
csv_file = 'db/customer_data.csv' | |
importer = Import::ImportCustomer.new(IO.read(csv_file)) | |
importer.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>div composing example</title> | |
<style type="text/css"> | |
html, body { | |
margin:0; | |
padding:0; | |
background-color: #ddd; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTML code | |
//<h2>Your seat reservations (<span data-bind="text: seats().length"></span>)</h2> | |
//<table> | |
// <thead><tr> | |
// <th>Passenger name</th><th>Meal</th><th>Surcharge</th><th></th> | |
// </tr></thead> | |
// <!-- Todo: Generate table body --> | |
// <tbody data-bind="foreach: seats"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class NoAlias | |
def nice_method | |
puts 'I am the nice method' | |
end | |
def even_nicer_method | |
puts 'I am the even nicer method' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alias | |
def even_nicer_method | |
puts 'I am the total perfect method' | |
end | |
alias :nice_method :even_nicer_method | |
end | |
puts 'Example with the usage of alias' | |
Alias.new.nice_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AliasMethod | |
def even_nicer_method | |
puts 'AliasMethod::even_nicer_method called' | |
end | |
alias_method :nice_method, :even_nicer_method | |
end | |
puts 'Example with usage of alias_method' | |
AliasMethod.new.nice_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mother | |
def say_name | |
puts 'I am the Mother' | |
end | |
alias :name :say_name | |
#alias_method :name, :say_name | |
end | |
class Child < Mother |