This file contains hidden or 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
# provides a slick way to add classes inside haml attribute collections | |
# | |
# examples: | |
# %div{add_class("current")} | |
# #=> adds the "current" class to the div | |
# | |
# %div{add_class("current", :if => current?)} | |
# #=> adds the "current" class to the div if current? method | |
# | |
# %div{add_class("highlight", :unless => logged_in?)} |
This file contains hidden or 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
@contact = Contact.find params[:id] | |
@contact.attributes = params[:contact] | |
if params[:is_supplier] == '1' | |
@contact.type = 'supplier' | |
elsif params[:is_supplier] == '0' | |
@contact.type = 'customer' | |
end | |
if @contact.save |
This file contains hidden or 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
resources :users do | |
# /users/:id/confirm_email(.:format) | |
# confirm_mail_user_path | |
get :confirm_email, :on => :member | |
end |
This file contains hidden or 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
@subject_all = [] | |
@subjects.each do |subject| | |
@subject_all << [subject.id, subject.batch.name] | |
end | |
# Or with a hash: | |
# | |
# @subject_all = {} | |
# |
This file contains hidden or 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
= image_tag((news.image || 'noimageavailable.jpg'), :width => 180, :height => 150, :style => 'float:left;margin-right: 10px;') |
This file contains hidden or 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
<%= form_for @tbl_providers_connection_info do |f| %> | |
<%= field_set_tag nil, :class => 'sectionwrap' do %> | |
<p> | |
<%= f.label :ssl_enabled, 'SSL Enabled:' %> | |
<%= f.check_box :ssl_enabled %> | |
</p> | |
<p> | |
<%= f.label :keystore, 'Keystore:' %> | |
<%= f.text_field :keystore %> | |
</p> |
This file contains hidden or 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
require 'rubygems' | |
require 'sinatra/base' | |
require 'person' | |
require 'csv' | |
require 'pp' | |
class Application < Sinatra::Base | |
def self.empty_arrays | |
set :people, [] | |
set :pups, [] |
This file contains hidden or 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
%u Στοιχεία για λέξη #{@word} | |
Αρ. Καταχώρισης: #{@id} | |
Sha1: #{@sha1} | |
Web ranking: #{@wr} at date: #{@wrd} |
This file contains hidden or 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
source 'http://rubygems.org/' | |
gem 'sinatra', '~> 1.3.0' | |
gem 'thin' | |
gem 'haml' |
This file contains hidden or 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 Domain < ActiveRecord::Base | |
attr_accessible :transport, :name | |
belongs_to :company | |
validates :name, new_domain: true, presence: true | |
end | |
def create |
OlderNewer