Skip to content

Instantly share code, notes, and snippets.

@pcasaretto
Created February 19, 2014 16:19
Show Gist options
  • Save pcasaretto/9095442 to your computer and use it in GitHub Desktop.
Save pcasaretto/9095442 to your computer and use it in GitHub Desktop.
# /Users/pcasaretto/src/rdstation/app/controllers/blog/title_controller.rb
class Blog::TitleController < ApplicationController
def new
@noun = params[:termo]
end
def create
noun = params[:noun]
if(!noun.blank?)
title_list = Blog::Title.list(noun)
@titles = title_list.shuffle[0..6]
render :show
else
flash.now[:error] = "Insira um termo como, por exemplo, landing pages"
render :new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment