This file contains 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 'digest' | |
class User < ActiveRecord::Base | |
validates_uniqueness_of :email | |
validates_length_of :email, :within => 5..50 | |
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i | |
validates_confirmation_of :password | |
validates_length_of :password, :within => 4..20 | |
validates_presence_of :password, :if => :password_required? | |
has_one :profile | |
has_many :articles, -> {order('published_at DESC, title ASC')}, |
This file contains 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(@user) do |f| %> | |
<% if @user.errors.any? %> | |
<div id="error_explanation"> | |
<h2> | |
<%= pluralize(@user.errors.count, "error") %> | |
prohibited this user from being saved: | |
</h2> | |
<ul> | |
<% @user.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> |
This file contains 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
/* | |
* This is a manifest file that'll be compiled into application.css, which will include all the files | |
* listed below. | |
* | |
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | |
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. | |
* | |
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | |
* compiled file so the styles you add here take precedence over styles defined in any styles | |
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new |
This file contains 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
module PhotoAssociations | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def has_many_photos(name) | |
has_many name, -> { where(kind: name.to_s) }, { as: :photoable, class_name: 'Photo' } | |
end | |
def has_one_photo(name) | |
has_one name, -> { where(kind: name.to_s).order('id desc') }, { as: :photoable, class_name: 'Photo' } |
This file contains 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 CreateTacos < ActiveRecord::Migration | |
def self.up | |
create_table :tacos do |t| | |
t.string :name | |
t.text :ingredients | |
t.timestamps null: false | |
end | |
end | |
def self.down |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains 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
譁ー縺励>遐比ソョ繧貞女縺代◆縺代l縺ー | |
繧ケ繧ソ繝�ヵ��が繝シ繝翫�縺ァ逶ク隲�@縺ェ縺後i螳溯。後\ | |
繧ケ繧ソ繝�ヵ縺ョ螢ー縺ォ蠢懊∴繧九�縺後さ繧ウ縺ァ縺吮飭 | |
螂ウ諤ァ縺ョ繧ュ繝」繝ェ繧「繧ょソ懈抄� | |
譌「蟀夊\�d繧ュ繝」繝ェ繧「蠢怜髄縺ョ繧ケ繧ソ繝�ヵ縺ェ縺ゥ螟壽焚蝨ィ邀坂飭 | |
隕句ュヲ繧ょ、ァ豁楢ソ寂� | |
窶サ8譛医°繧峨い繧、繝ゥ繝�す繝・繝。繝九Η繝シ蟆主� 迢ャ遶九r逶ョ謖�@縺ヲ繧区婿縲∝ョカ蠎ュ繧偵♀謖√■縺ョ譁ケ縲 | |
縺セ縺 縺セ縺 謚\陦薙r逎ィ縺�※縺�″縺溘>譁ケ縲 |
This file contains 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
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. | |
/home/thinb/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150330-23351-di5g3p.rb extconf.rb | |
checking for rb_thread_blocking_region()... no | |
checking for sys/select.h... yes | |
checking for poll.h... yes | |
checking for sys/epoll.h... yes | |
checking for sys/event.h... no | |
checking for port.h... no | |
checking for sys/resource.h... yes |
This file contains 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 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.5' | |
# Use mysql as the database for Active Record | |
gem 'mysql2' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0' |
This file contains 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(@product) do |f| %> | |
<% if @product.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2> | |
<ul> | |
<% @product.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
This file contains 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 Admin::AdminController < ApplicationController | |
authorize_resource :class => false | |
layout "admin" | |
end |
OlderNewer