Skip to content

Instantly share code, notes, and snippets.

View xander-miller's full-sized avatar

Xander Miller xander-miller

View GitHub Profile
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
# if a member, they can manage their own posts
# (or create new ones)
if user.role? :member
can :manage, Wiki, private: true, Wiki.collaborators do |collaborator|
require 'faker'
# Create 15 Topics
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
@xander-miller
xander-miller / index.html
Last active August 29, 2015 13:57
Anne's project
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
require 'faker'
# Create 15 topics
topics =[]
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
require 'faker'
# Create 15 topics
topics =[]
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
require 'faker'
# Create 15 topics
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.words(rand(1..10)).join(" "),
description: Faker::Lorem.paragraph(rand(1..4))
)
end
require 'faker'
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.words(rand(1..10)).join(" "),
description: Faker::Lorem.paragraph(rand(1..4))
)
end
require 'faker'
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.words(rand(1..10)).join(" "),
description: Faker::Lorem.paragraph(rand(1..4))
)
end
Whatever::Application.routes.draw do
resources :posts do
resources :comments, only: [:create, :destroy], controller: 'posts/comments'
end
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks', registrations: 'users/registrations' }
resources :users, only: [:show]
require 'faker'
# Create 15 topics
topics =[]
60.times do
topic = Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
topic.save