Permalink
Browse files

added schema.sql and changed subject field to title

  • Loading branch information...
1 parent 59b5ad5 commit c08d1b3959c08074394c0c77ab020f358bbbfbfe @josegonzalez committed Jun 25, 2011
Showing with 4 additions and 5 deletions.
  1. +0 −1 config/schema/schema.sql
  2. +3 −3 controllers/posts_controller.php
  3. +1 −1 views/posts/auto_complete.ctp
View
@@ -6,5 +6,4 @@ CREATE TABLE `posts` (
`created` date DEFAULT NULL,
`active` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
- UNIQUE KEY `link` (`link`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -3,12 +3,12 @@ class PostsController extends AppController {
function auto_complete() {
//Partial strings will come from the autocomplete field as
- //$this->data['Post']['subject']
+ //$this->data['Post']['title']
$this->set('posts', $this->Post->find('all', array(
'conditions' => array(
- 'Post.subject LIKE' => $this->data['Post']['subject'].'%'
+ 'Post.title LIKE' => $this->data['Post']['title'].'%'
),
- 'fields' => array('subject')
+ 'fields' => array('title')
)));
$this->layout = 'ajax';
}
@@ -1,5 +1,5 @@
<ul>
<?php foreach($posts as $post): ?>
- <li><?php echo $post['Post']['subject']; ?></li>
+ <li><?php echo $post['Post']['title']; ?></li>
<?php endforeach; ?>
</ul>

0 comments on commit c08d1b3

Please sign in to comment.