Class: Postablr::BlogController

Inherits:
ApplicationController show all
Defined in:
app/controllers/postablr/blog_controller.rb

Instance Method Summary collapse

Instance Method Details

#filterObject



10
11
12
13
# File 'app/controllers/postablr/blog_controller.rb', line 10

def filter
  @entries = Postablr::Entry.includes(:postable).published.where("postablr_entries.postable_type =?", "Entry::#{params[:filter].capitalize}").order("postablr_entries.created_at desc").page(params[:page]).per(6)
  render :show
end

#showObject



6
7
8
# File 'app/controllers/postablr/blog_controller.rb', line 6

def show
  @entries = Postablr::Entry.includes(:postable).published.order("postablr_entries.postable_type.created_at desc").page(params[:page]).per(6)
end

#tags_getObject



15
16
17
18
19
# File 'app/controllers/postablr/blog_controller.rb', line 15

def tags_get
  @q = params[:tag]
  @tags = ActsAsTaggableOn::Tag.where{( name =~ "#{@q}%")}
  render :json=> @tags.collect{ |tag| {"caption"=> tag.name, "value"=>tag.id.to_s } }
end