> Hey guys! I did create a search form for an extension of the standard
> refniery app. This extension stands for publications which can be found
> with three search terms like "author", "date" and "title".
> It works on my local machine. After I deploy it to heroku I just get this
> error message ... "We're sorry, but something went wrong."
> I hope someone can help me ...
>
> Here is a part of the full log:
>
> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in
>>
>> `pass'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in
>>
>> `invalidate'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in
>> `call'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in
>>
>> `forward'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in
>>
>> `call'
>> 2013-07-30T10:14:32.782114+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in
>>
>> `call'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in
>> `service'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in
>>
>> `call'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:479:in
>> `call'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in
>> start_thread'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in
>> `call!'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/content_length.rb:14:in
>> `call'
>> 2013-07-30T10:14:32.782624+00:00 app[web.1]:
>> vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
>> 2013-07-30T10:14:32.782472+00:00 app[web.1]:
>> vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:223:in
>>
>> `call'
>> 2013-07-30T10:14:32.784993+00:00 app[web.1]: Rendered
>> vendor/extensions/publications/app/views/refinery/publications/publications/index.html.erb
>>
>> within layouts/application (721.8ms)
>> 2013-07-30T10:14:32.784993+00:00 app[web.1]: Completed 500 Internal
>> Server Error in 738ms
>> 2013-07-30T10:14:32.784993+00:00 app[web.1]: Processing by
>> Refinery::Publications::PublicationsController#search as HTML
>> 2013-07-30T10:14:32.784993+00:00 app[web.1]: Parameters: {"utf8"=>"✓",
>> "authenticity_token"=>"88vYJKWcs7Xjb/OGHVYg13AW5SibRJGk8OvQrbeliqA=",
>> "search_author"=>"ang", "search_title"=>"", "search_year"=>"",
>> "commit"=>"Search", "locale"=>:en}
>>
>
> My routes (from the extension):
>
>> Refinery::Core::Engine.routes.append do
>>
>> # Frontend routes
>> namespace :publications do
>> resources :publications, :path => '', :only => [:index, :show]
>> match '/get_pubs' => 'publications#search'
>> end
>>
>>
>> # Admin routes
>> namespace :publications, :path => '' do
>> namespace :admin, :path => 'refinery' do
>> resources :publications, :except => :show do
>> collection do
>> post :update_positions
>> end
>> end
>> end
>> end
>>
>> end
>
>
> My search form:
>
>> <% content_for :body do %>
>> <ul id="publications">
>>
>> <%= form_tag "/publications/get_pubs", method: :post do %>
>> <table>
>> <tr>
>> <td>
>> <b>Author:</b>
>> </td>
>> <td>
>> <b>Title:</b>
>> </td>
>> <td>
>> <b>Year:</b>
>> </td>
>> </tr>
>> <tr>
>> <td>
>> <%= text_field_tag :search_author, '' %>
>> </td>
>> <td>
>> <%= text_field_tag :search_title, '' %>
>> </td>
>> <td>
>> <%= text_field_tag :search_year, '' %>
>> </td>
>> </tr>
>> </table>
>> <%= submit_tag "Search" %>
>> <% end %>
>
> .....
>>
>
> My Model:
>
>> module Refinery
>> module Publications
>> class Publication < Refinery::Core::BaseModel
>> self.table_name = 'refinery_publications'
>>
>> attr_accessible :title, :authors, :year, :publisher, :position
>>
>> acts_as_indexed :fields => [:title, :authors, :publisher]
>>
>> validates :title, :presence => true, :uniqueness => true
>>
>> def self.search(query1,query2,query3)
>> # where(:title, query) -> This would return an exact match of
>> the query
>> where("authors like ?", "%#{query1}%").where("title like ?",
>> "%#{query2}%" ).where("year like ?", "%#{query3}%" )
>> end
>> end
>> end
>> end
>>
>
> My Controller:
>
>> module Refinery
>> module Publications
>> class PublicationsController < ::ApplicationController
>> before_filter :find_all_publications
>> before_filter :find_page
>>
>> def index
>> # you can use meta fields from your model instead (e.g.
>> browser_title)
>> # by swapping @page for @publication in the line below:
>> present(@page)
>> end
>>
>> def show
>> @publication = Publication.find(params[:id])
>>
>> # you can use meta fields from your model instead (e.g.
>> browser_title)
>> # by swapping @page for @publication in the line below:
>> present(@page)
>> end
>>
>> def search
>> @publications =
>> Publication.search(params[:search_author],params[:search_title],params[:search_year]).order("year").reverse_order
>> #@publications = @publications.first
>> render action: 'index'
>> end
>>
>>
>> protected
>>
>> def find_all_publications
>> @publications = Publication.order("year").reverse_order
>> end
>>
>> def find_page
>> @page = ::Refinery::Page.where(:link_url => "/publications").first
>> end
>>
>> end
>> end
>> end
>>
>>
>
>>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Heroku" group.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups
"Heroku Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.