Skip to content

Instantly share code, notes, and snippets.

View baileylo's full-sized avatar

Logan Bailey baileylo

View GitHub Profile
<?php
$model_object = parse_ini_file('object_map.ini');
function __autoload($class_name) {
global $model_object;
$class_name = strtolower($class_name);
if (!isset($model_object[$class_name])) {
exit('invalid class name');
}
require_once($model_object[$class_name]);
<?php
$fp = fopen('object_map.ini', 'w');
foreach($ini_config_data as $class => $filename) {
$write = $class . ' = ' . $filename . PHP_EOL;
fwrite($fp, $write, strlen($write));
}
fclose($fp);
?>
<?php
$model_object = parse_ini_file('object_map.ini');
function __autoload($class_name) {
global $model_object;
$class_name = strtolower($class_name);
if (!isset($model_object[$class_name])) {
exit('invalid class name');
}
<h1 id="page_title">Login</h1>
<%= render 'form' %>
<%= link_to 'Back', homepage_url %>
@baileylo
baileylo / edit.html.erb
Created October 20, 2010 06:31
Changed Title and Back link to homepage
<h1 id="page_title">Edit Your Profile</h1>
<%= render 'form' %>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', homepage_url %>
@baileylo
baileylo / user_controller.rb
Created October 20, 2010 06:22
Removed unused functions, fixed redirects, and much much less awesomeness
class UsersController < ApplicationController
# GET /users/1
def show
@user = User.find(params[:id])
end
# GET /users/new
def new
@user = User.new
@baileylo
baileylo / conversation.rb
Created October 19, 2010 08:41
New functions for conversation controller
# GET /conversations/new
def new
@conversation = Conversation.new
@comment = @conversation.comments.build
respond_to do |format|
format.html # new.html.erb
end
end
@baileylo
baileylo / _form.html.erb
Created October 19, 2010 08:40
Code to display conversations
<%= form_for(@conversation, :url => board_conversations_path) do |f| %>
<% if @conversation.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@conversation.errors.count, "error") %> prohibited this conversation from being saved:</h2>
<ul>
<% @conversation.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@baileylo
baileylo / _reply_form.html.erb
Created October 19, 2010 08:37
Included template view for replying to conversations
<%= form_for(@comment, :url => reply_board_conversation_url(:board_id=>@board, :id=>@conversation)) do |f| %>
<% if @comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this reply from being saved:</h2>
<ul>
<% @comment.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@baileylo
baileylo / conversation.rb
Created October 19, 2010 08:32
Created functions for reply to posts
# GET /conversations/reply
def reply
@conversation = Conversation.find(params[:id])
@comment = @conversation.comments.build
respond_to do |format|
format.html #reply.html.erb
end
end