##References
##Create Rails App
command to make new directory:
mkdir AppName
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.irregular 'noticia', 'noticias' | |
end |
##References
##Create Rails App
command to make new directory:
mkdir AppName
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.
// SASS variable overrides must be declared before loading up Active Admin's styles. | |
// | |
// To view the variables that Active Admin provides, take a look at | |
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the | |
// Active Admin source. | |
// | |
// For example, to change the sidebar width: | |
// $sidebar-width: 242px; | |
// Active Admin's got SASS! |
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx | |
HISTFILESIZE=100000000 | |
alias ll="ls -la" | |
alias rss="python manage.py runserver 0.0.0.0:8000" | |
export PS1="[\u@\w]\$: " | |
alias cg="cd ~/git/" | |
alias restart_nginx='/usr/local/Cellar/nginx/1.4.1/bin/nginx -s reload' | |
alias mysass='sass --watch --sourcemap' | |
. ~/.nvm/nvm.sh |
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
# Shamelessly copied from https://github.com/gf3/dotfiles | |
default_username='username' | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi |
node_modules/ | |
local_settings.py | |
settings_local.py | |
*.pyc | |
*.sqlite | |
/media | |
.DS_Store | |
/.idea/ |
#!/usr/bin/ruby | |
require 'rss' | |
# Usage | |
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
# episodes.rss | |
# OR | |
# $ ./railscasts.rb | |
p 'Downloading rss index' |
In your view:
<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>
In your controller:
respond_to :html, :js, only: [:index]
def index
# encoding: utf-8 | |
# Be sure to restart your server when you modify this file. | |
# Add new inflection rules using the following format | |
# (all these examples are active by default): | |
# ActiveSupport::Inflector.inflections do |inflect| | |
# inflect.plural /^(ox)$/i, '\1en' | |
# inflect.singular /^(ox)en/i, '\1' | |
# inflect.irregular 'person', 'people' | |
# inflect.uncountable %w( fish sheep ) |