Skip to content

Instantly share code, notes, and snippets.

<%= form_for(@profile) do |f| %>
<p>
<%= f.label :Profile_Name %><br>
<%= f.text_field :profile_name %>
</p>
<p>
<%= f.label :Background %><br>
<%= f.text_area :about %>
<div class="page-header">
<h1>All Profiles</h1>
</div>
<p>
<div class="tag_cloud">
<% tag_cloud Profile.interest_counts, %w{s m l} do |interest, css_class| %>
<%= link_to interest.name, interest_path(interest.name), class: css_class %>
<% end %>
</div>
<div class="profile-present">
<div id="profile-profile_name">
<h1>
<p>
<%= @profile.profile_name %></span>
</p>
</h1>
</div><hr/>
class ProfilesController < ApplicationController
before_filter :authenticate_user!, only: [:create, :new, :edit, :update, :destroy]
#added destroy to above, not in Treebook
def index
if params[:interest]
@profiles = Profile.tagged_with(params[:interest])
else
@profiles = Profile.all
end
Network::Application.routes.draw do
resources :profiles do
end
get "profiles/show"
devise_for :users, :controllers => {:registrations => "users/registrations"}
get 'tags/:tag', to: 'events#index', as: :tag
get 'interests/:interest', to: 'profiles#index', as: :interest
get 'skills/:skill', to: 'profiles#index', as: :skill
class Profile < ActiveRecord::Base
acts_as_taggable_on :interests, :skills
end
@attatae
attatae / gist:10436529
Created April 11, 2014 01:41
profiles controller snippet.rb
def index
if params[:interest]
@profiles = Profile.tagged_with(params[:interest], :on => :interests)
else
@profiles = Profile.all
end
if params[:skill]
@profiles = Profile.tagged_with(params[:skill], :on => :skills)
else
<!DOCTYPE html>
<html>
<head>
<title>Network</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
<div class="page-header">
<h1>All Events</h1>
</div>
<%= link_to 'New Event', new_event_path, class: "btn btn-primary" %>
<div id="post-btn-margin">
</div>
<% @events.each do |event| %>
<div class="event">