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
#=> config/database.rb | |
postgres = URI.parse(ENV['DATABASE_URL'] || '') | |
ActiveRecord::Base.configurations[:production] = { | |
:adapter => 'postgresql', | |
:encoding => 'utf8', | |
:database => postgres.path[1..-1], | |
:username => postgres.user, | |
:password => postgres.password, | |
:host => postgres.host |
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
puts ActiveRecord::Base.connection.execute("PRAGMA table_info('pages')").to_yaml | |
puts ActiveRecord::Base.connection.execute("PRAGMA encoding").to_yaml |
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 :rubygems | |
gem 'shotgun', :group=>:development | |
gem 'rack-cache' | |
gem 'sinatra', :require => 'sinatra/base' | |
gem 'sinatra-support' | |
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
rails g scaffold Page slug:string title:string parent_id:integer content:text excerpt:string seo_title:string seo_desc:string seo_keys:string | |
rails g scaffold Product slug:string brand:references name:string type:string price:integer options:text features:text design:text description:text slogan:string | |
rails g scaffold Brand name:string country:string slogan:string description:text logo:string image:string flag:string | |
rails g scaffold Category slug:string name:string description:text |
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
Assets precompile: | |
config.assets.initialize_on_precompile = false #config/application.rb - it works | |
config.assets.precompile = %w{application.js} #config/application.rb - may work |
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
rails new myapp -T # excludes Unit Test | |
# config/application.rb: | |
config.generators do |g| | |
g.test_framework :rspec | |
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
#place this in config/locales/translit.rb | |
# encoding: utf-8 | |
# I18n transliteration delegates to Russian::Transliteration (we're unable | |
# to use common I18n transliteration tables with Russian) | |
# | |
# Правило транслитерации для I18n использует Russian::Transliteration | |
# (использовать обычный механизм и таблицу транслитерации I18n с | |
# русским языком не получится) |
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
rails new app -T --skip-active-record | |
cd app | |
# пофиксить sed -i "s/# config.time_zone = 'Central Time (US & Canada)'/config.time_zone = 'Europe/Moscow'/" config/application.rb | |
sed -i 's/# config.i18n.default_locale = :de/config.i18n.default_locale = :ru/' config/application.rb | |
echo -e "gem 'mongoid'\n" >> Gemfile | |
echo -e "group :production do\n gem 'unicorn'\n gem 'newrelic_rpm'\nend\n" >> Gemfile | |
bundle install | |
#echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >> Procfile | |
'web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb' >> Procfile | |
echo -e 'preload_app true\ntimeout 15' >> config/unicorn.rb |
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 Test | |
def procedure | |
nil | |
end | |
end | |
I am trying to achieve this: | |
class Test | |
def procedure | |
nil |
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
!!! 5 | |
%html | |
%head | |
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"} | |
%title= content_for?(:title) ? yield(:title) : "Rails Test" | |
%meta{:content => content_for?(:description) ? yield(:description) : "Rails Test", :name => "description"} | |
= stylesheet_link_tag "application", :media => "all" | |
= javascript_include_tag "application" | |
= csrf_meta_tags | |
= yield(:head) |