RORLabNew/rorla — pull request #48 by rorlab (2014-08-25 08:51:27+00:00)
Title: Favlink 모델에 full-text 검색 기능추가

attr_searchable 젬을 이용하여 Favlink 모델에 Full-text 검색 기능을 추가함.

in Gemfile
```
gem 'attr_searchable'
```

in Favlink.rb
```
include AttrSearchable

attr_searchable :title, :description
attr_searchable :bundlelink => "bundlelink.title"
```

in favlinks_controller.rb
```
- @favlinks = @bundlelink ? @bundlelink.favlinks : (params[:whose] ? Favlink.whose(current_user) : Favlink.shared)
+ if params[:search]
+ @favlinks = Favlink.search(params[:search])
+ else
+ @favlinks = @bundlelink ? @bundlelink.favlinks : (params[:whose] ? Favlink.whose(current_user) : Favlink.shared)
+ end
```

in _sidebar.html.erb
```

```