Skip to content

Instantly share code, notes, and snippets.

View rubytastic's full-sized avatar

rubytastic rubytastic

View GitHub Profile
validates :email,
:exclusion => {:in => ["mydomain"],
:message => "is reserved" }
- title t(:title, :scope => :register)
%h1= yield(:title)
#col1
%p
=t(:welcome_text, :scope => :register)
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= devise_error_messages!
= simple_form_for @message do |f|
-if @message.errors.any?
#error_explanation
%h2= "#{pluralize(@message.errors.count, "error")} prohibited this message from being saved:"
%ul
- @message.errors.full_messages.each do |msg|
%li= msg
class HomeController < ApplicationController
before_filter :authenticate_user!, :except =>"index"
def index
if user_signed_in?
@user = Profile.find(current_user)
#flash
- unless flash.empty?
= content_tag :div, flash[:notice], :class => "notice" if flash[:notice]
= content_tag :div, flash[:warning], :class => "warning" if flash[:warning]
= content_tag :div, flash[:error], :class => "error" if flash[:error]
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :check_beta
before_filter :set_locale
def check_beta
if APP_CONFIG['beta'] = true
* sessions are like groups, nothing to do with logged in
class Session < ActiveRecord::Base
has_many :participants
has_many :users, :through => :participants
end
- content_for :js_manual do
= javascript_include_tag 'js_manual/counters/members'
# == Schema Information
#
# Table name: assets
#
# id :integer(4) not null, primary key
# description :text
# file :string(255)
# attachable_id :integer(4)
# attachable_type :string(255)
# created_at :datetime
namespace :db do
desc "Populate Users Table with images from /public/feedimg"
task :populate => :environment do
require "populator"
require "faker"
User.populate 1 do |user|
user.username = Faker::Name.first_name.downcase
user.email = Faker::Internet.user_name + "@myhost.com".downcase
user.encrypted_password = "27e50904b7a1c29a43e347eef5f6144303b516b7364a4a093e022435e0b3479024d57cbfds32499c30154a1a3e0d903c12b320c4f44844aa4d52c49b31f58f"