Class: Areas::PostsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/areas/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
# File 'app/controllers/areas/posts_controller.rb', line 14

def create
  @post.save!
  redirect_to(area_path(@area), :notice => 'Your message has been successfully posted.')
rescue ActiveRecord::RecordInvalid
  render :action => :new
end

#indexObject



5
6
7
8
9
# File 'app/controllers/areas/posts_controller.rb', line 5

def index
  params[:search] ||= {}
  @search = @area.posts.order('created_at DESC').joins(:issue).where('sent_at IS NOT NULL').search(params[:search])
  @posts = @search.paginate(:page => params[:page])
end

#newObject



11
12
# File 'app/controllers/areas/posts_controller.rb', line 11

def new
end