This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
1. Add 10gen package to source.list.d | |
Ubuntu 12 comes with a “mongo” package, but not the latest version. | |
$ sudo apt-cache search mongodb | |
mongodb | |
mongodb-clients | |
mongodb-dev | |
mongodb-server | |
It’s recommended to add 10gen package to /etc/apt/sources.list.d, as it contains the latest stable MongoDB. Create a /etc/apt/sources.list.d/mongo.list file, and declared the 10gen distro. |
#!/usr/bin/ruby | |
require 'rss' | |
# Usage | |
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
# episodes.rss | |
# OR | |
# $ ./railscasts.rb | |
p 'Downloading rss index' |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Rails App</title> | |
<%- if protect_against_forgery? -%> | |
<meta name="authenticity-token" id="authenticity-token" content="<%= form_authenticity_token %>" /> | |
<%- end -%> | |
<%= javascript_include_tag 'jquery', 'rails' %> | |
</head> | |
<body> |
1. Clone the Repo and Add to User Directory | |
1 | |
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) | |
This command uses cURL to grab the GitHub repo and install it into your user directory. The file that this repo is placed in is ~/.gvm. | |
2. Open Your ~/.bashrc and Source the GVM Directory | |
1 |
upstream puma { | |
server unix:///home/deploy/apps/avtomat_kalashnikova/shared/tmp/sockets/avtomat_kalashnikova-puma.sock; | |
} | |
server { | |
listen 80 default_server deferred; | |
# server_name example.com; | |
root /home/deploy/apps/avtomat_kalashnikova/current/public; | |
access_log /home/deploy/apps/avtomat_kalashnikova/current/log/nginx.access.log; |
upstream project { | |
server unix:///home/deploy/apps/avtomat_kalashnikova/shared/tmp/sockets/avtomat_kalashnikova-puma.sock; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
root /home/deploy/apps/avtomat_kalashnikova/current/public; | |
module AmazonSignature | |
extend self | |
def signature | |
Base64.encode64( | |
OpenSSL::HMAC.digest( | |
OpenSSL::Digest.new('sha1'), | |
AWS_CONFIG['secret_access_key'], self.policy | |
) | |
).gsub("\n", "") |