RoR - ActionView Template Error - ruby-on-rails

I'm trying to implement new redmine and then migrate my data from old redmine to new redmine.
But there is an template error showing in the log
ActionView::Template::Error (undefined method `is_closed?' for nil:NilClass):
6: <h3><%= format_activity_day(day) %></h3>
7: <dl>
8: <% sort_activity_events(#events_by_day[day]).each do |e, in_group| -%>
9: <dt class="<%= e.event_type %> <%= "grouped" if in_group %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
10: <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
11: <span class="time"><%= format_time(e.event_datetime, false) %></span>
12: <%= content_tag('span', h(e.project), :class => 'project') if #project.nil? || #project != e.project %>
app/models/issue.rb:677:in `closed?'
app/models/issue.rb:57:in `block in <class:Issue>'
I guess this monday is occured when the css is rendered.
Is there any idea about this problem?
or how to log and find the real cause of the problem?
Thanks

Related

Elasticsearch & Bonsai: IndexMissingException on Heroku, works fine locally

Building my first rails app and having issues getting Elasticsearch to run on Heroku.
Local works perfect.
On Heroku I can open the search page, but when I try to perform a search I get the error below:
Heroku logs show:
2015-05-18T12:05:15.969673+00:00 app[web.1]: ActionView::Template::Error ([404] {"error":"IndexMissingException[[homes] missing]","status":404}):
2015-05-18T12:05:15.969674+00:00 app[web.1]: 9: <% end %>
2015-05-18T12:05:15.969676+00:00 app[web.1]: 10:
2015-05-18T12:05:15.969677+00:00 app[web.1]: 11: <ul>
2015-05-18T12:05:15.969678+00:00 app[web.1]: 12: <% #homes.each do |home| %>
2015-05-18T12:05:15.969679+00:00 app[web.1]: 13: <li>
2015-05-18T12:05:15.969680+00:00 app[web.1]: 14: <h3>
2015-05-18T12:05:15.969682+00:00 app[web.1]: 15: <%= link_to home.name, controller: "homes", action: "show", id: home._id%>
2015-05-18T12:05:15.969683+00:00 app[web.1]: app/views/search/search.html.erb:12:in `_app_views_search_search_html_erb___1261310385184340853_69929402195100'
Gems:
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'bonsai-elasticsearch-rails', '~> 0.0.4'
Search Controller:
class SearchController < ApplicationController
def search
if params[:q].nil?
#homes = []
else
#homes = Home.search params[:q]
end
end
end
Search View:
<h1>Homes Search</h1>
<%= form_for search_path, method: :get do |f| %>
<p>
<%= f.label "Search for" %>
<%= text_field_tag :q, params[:q] %>
<%= submit_tag "Go", name: nil %>
</p>
<% end %>
<ul>
<% #homes.each do |home| %>
<li>
<h3>
<%= link_to home.name, controller: "homes", action: "show", id: home._id%>
</h3>
</li>
<% end %>
</ul>
Any suggestions would be greatly appreciated!
The problem is similar to this issue.
The solution involves
running the tasks highlighted here
making sure the elasticsearch.rake exists
and finally if the 404 still happens to create the index manually using curl -XPOST http://account.region.bonsai.io/homes

ActionView::Template::Error (undefined method `+' for nil:NilClass):

One of my pages keeps hitting this error:
ActionView::Template::Error (undefined method `+' for nil:NilClass):
15: <div class="look_list">
16: <% collection.each do |look| %>
17: <div class="look_book" id="<%= look.content_id %>">
18: <% thumbnail_image = (look.processing? ? "/assets/processing_placeholder.gif" : (look.image.url(:thumb) + "?#{look.updated_at.to_i}")) %>
19: <%= image_tag thumbnail_image || "/assets/processing_placeholder.gif",:class=> "look_image", :size => "118x118" %>
20: <script type="text/javascript">
21:
app/views/looks/index.html.erb:18:in `block in _app_views_looks_index_html_erb__3409922204803071014_68666020'
app/views/looks/index.html.erb:16:in `_app_views_looks_index_html_erb__3409922204803071014_68666020'
Some background, my site hit into 502 bad gateway 2 days ago. We managed to restart the site. However, it caused some connection issue with mongodb. This was resolved after we restart the DB. However, this one page keep hitting the error above. This has never happened before. Any one can help?
what is the value of look.image.url(:thumb) before line 18 executes? That is where the error is thrown, and it is the only place I am seeing a +
I'd check your data, to see if the crash caused data loss somewhere, in particular, on the data needed for that method
Try out something like this .....
<div class="look_list">
<% collection.each do |look| %>
<div class="look_book" id="<%= look.content_id %>">
<% thumbnail_image = look.image.url(:thumb) unless look.processing? %>
<% thumbnail_image.nil? ? "/assets/processing_placeholder.gif" : (look.image.url(:thumb) + "?#{look.updated_at.to_i}") %>
<%= image_tag thumbnail_image ,:class=> "look_image", :size => "118x118" %>
</div>
<% end %>
</div>

Spree validate field

I am using Spree for an e-commerce app and I'm trying to validate uniqueness of sku
Spree::Variant.class_eval do
attr_accessible :sku
validates_uniqueness_of :sku
end
Then when I want to create a new record I get this error:
undefined method `price' for nil:NilClass
Extracted source (around line #7):
4: <% content_for :sidebar do %>
5:
6: <h3>
7: <%= #product.name %><span class="sku"><%= #product.sku %></span>
8: </h3>
9: <br class="clear"><ul class="sidebar product-menu" data-hook="admin_product_tabs">
10: <li <%== ' class="active"' if current == 'Product Details' %>>
After almost a year...
You need to write a custom validation in model with something like this
validate :validate_sku, :on => :create
private
def validate_sku
if Spree::Variant.exists?(:sku => sku)
errors.add(:sku, "SKU kod je již používán")
end
end

Pusher Chat Example Error

I am trying to work with tarnfeld's PusharChat-Rails
I downloaded the file, did the usual bundle install & db:migrate.
I changed the api key in PusherChat-Rails / app / views / layouts / application.html.erb
but I am getting this error
NoMethodError in Chat#view
Showing /Users/gkolan/work/PusherChat/app/views/chat/view.html.erb where line #22 raised:
undefined method `auto_link_urls' for #<#<Class:0x007fdddb772818>:0x007fdddb710230>
Extracted source (around line #22):
19: <ul id="messages">
20: <% #messages.each do |message| %>
21: <% user = ChatUser.find(message.user_id) %>
22: <li<% if user.id == #user.id %> class="you"<% end %>><strong><%= user.nickname %></strong> said:<br><%= auto_link_urls(message.message, { :target => "_blank" }) %></li>
23: <% end %>
24: </ul>
25: <div id="message-overlay"></div>
Rails.root: /Users/gkolan/work/PusherChat
I think its a very simple error. Could you please help me solve this?
Thanks in advance!
The auto_link_urls method has been deprecated for rails >= 3.1.0.
You may :
modify your Gemfile to use 3.0.9
add the rails_autolink gem to your Gemfile

Problem application Rails 2 using bundler

I am using Rails 2.3.11 end the error is:
NoMethodError in Configurations#index
Showing rails/ruby/1.8/gems/actionpack-2.3.11/lib/action_controller/templates/rescues/diagnostics.erb where line #7 raised:
private method `gsub' called for nil:NilClass
Extracted source (around line #7):
4: in <%=h request.parameters['controller'].humanize %>Controller<% if request.parameters['action'] %>#<%=h request.parameters['action'] %><% end %>
5: <% end %>
6: </h1>
7: <pre><%=h #exception.clean_message %></pre>
8:
9: <%= render :file => #rescues_path["rescues/_trace.erb"] %>
10:
My feeling is that #exception is null, since no exceptions were raised on page.
Try something like:
<% if !#exception.nil? %>
<%=h #exception.clean_message %>
<% end %>

Resources