Skip to content

Instantly share code, notes, and snippets.

View ugisozols's full-sized avatar

Uģis Ozols ugisozols

View GitHub Profile
class CreateAropenitems < ActiveRecord::Migration
def self.up
create_table :aropenitems do |t|
t.integer :cust_no
t.date :doc_date
t.integer :doc_no
t.string :doc_type, :limit => 1
t.integer :apply_to_no
t.date :doc_due_date
t.decimal :amt1, :precision => 9, :scale => 2
SampleApp::Application.routes.draw do |map|
match ':controller(/:action(/:id(.:format)))'
end
script/generate scaffold company title:string
script/generate scaffold address company_id:integer address:text
script/generate scaffold employee company_id:integer name:string surname:string
# company model
class Company < ActiveRecord::Base
has_one :address
has_many :employees
def score(dice)
points = 0
roll = { 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0 }
dice.each { |i| roll[i] += 1}
roll.each do |key, value|
case key
when 1
class Dog
def initialize(name)
@name = name
end
def bark
"#{@name} barks like a dog"
end
def eat
class Granny
attr_reader :name
def initialize(name)
@name = name
end
end
class Conversation
attr_reader :grannys
# features/refinery/manage_files
Scenario: Files Delete
Given I have no files
When I upload the file at "features/uploads/refinery_is_awesome.txt"
And I go to the list of files
And I follow "Remove this file forever"
Then I should have 0 file
# next line fails ...
# And I should see "'refinery_is_awesome.txt' was successfully destroyed."
# /refinerycms/vendor/refinerycms/images/app/views/admin/images/_form.html.erb
<%#= f.error_messages %>
<%= render "/shared/admin/error_messages", :object => @image %>
# /refinerycms/vendor/refinerycms/core/app/views/shared/admin/_error_messages.html.erb
<% if object.errors.any? %>
<div class="errorExplanation" id="errorExplanation">
<p><%= pluralize(object.errors.count, "error") %> prohibited this resource from being saved:</p>
<ul>
= Setup
=== In your browser
login to http://github.com
go to http://github.com/resolve/refinerycms
if you have a fork already, delete it (if you're not going to loose work. This makes it much easier for us to integrate your changes back in)
click on fork
=== In terminal
git clone [email protected]:USERNAME/refinerycms.git refinerycms
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
}