Problem application Rails 2 using bundler - ruby-on-rails

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 %>

Related

Undefined method link_to_remote error Rails

I make a link_to_remote but this are the error:
NoMethodError in Tasks#index
Showing /Users/overallduka/youimports_app/app/views/tasks/index.html.erb where line #6 raised:
undefined method `link_to_remote' for #<#<Class:0x1022c76f0>:0x10216ff00>
Extracted source (around line #6):
3: <div id="all_tasks">
4: <% #tasks.each do |task| %>
5: <%= task.title %><br />
6: <p class="about_task"><%= link_to_remote task.status,"alert('aaa')" %> <%= task.about %></p>
7: <% end %>
8: </div>
I dont know what is wrong i make a sample alert to test but the error persistes, i dont know what is wrong in my view are:
NoMethodError in Tasks#index
Showing /Users/overallduka/youimports_app/app/views/tasks/index.html.erb where line #6 raised:
undefined method `link_to_remote' for #<#:0x10216ff00>
Extracted source (around line #6):
<% #tasks.each do |task| %>
<%= task.title %><br />
<p class="about_task"><%= link_to_remote (status(task.status)),"alert('aaa')" %> <%= task.about %></p>
<% end %>
link_to_remote and other remote ajax helpers have been removed in rails 3 and moved to a gem https://github.com/rails/prototype_legacy_helper. if you are only trying to run a simple js after clicking a link, use link_to_function instead
link_to_function 'test_alert', 'alert("test")'

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>

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

need help with acts_as_ferret and will_paginate to play nice together

I have installed will_paginate and acts_as_ferret on my system for ruby rails.
My paginate seems to work fine before installing acts_as_ferret. When I put in the code to do searching I get the following error:
NoMethodError in Community#search
Showing app/views/community/_result_summary.rhtml where line #3 raised:
undefined method `total_entries' for []:Array
Extracted source (around line #3):
1: <% if #users %>
2: <p>
3: Found <%= pluralize(#users.total_entries, "match") %>.
4: </p>
5: <% end %>
If I take out the search function, paginate works but it's pointless because I can't do searches. Can any one help me out on this one??
Thanks!!
Stephen
undefined method `total_entries' for []:Array
eror itself shows that you are calling total_entries method which is not array method.
you get more than one user in your #users.
try
1: <% unless #users.blank? %>
2: <p>
3: Found <%= pluralize(#users[0].total_entries, "match") %>.
4: </p>
5: <% end %>
EDITED
TRY
1: <% unless #users.blank? %>
2: <p>
3: Found <%= pluralize(#users.length, "match") %>.
4: </p>
5: <% end %>

Rails pagination error

I'm using the will_paginate plugin and I get the following error only when I'm running on a server rather than locally:
undefined method `total_pages' for []:Array
Extracted source (around line #8):
5: <% session[:page] = params[:page] %>
6: <h2>Previous Scenario</h2>
7: <% end %>
8: <%= will_paginate #scenarios, :next_label => 'Older', :prev_label => 'Newer' %>
9: <div class="box">
10: <% for scenario in #scenarios %>
11: <% #created = scenario.created_at %>
Any ideas?
Somehow, #scenarios is an ordinary Array for you and it can't be from Scenario.paginate() method because that one always returns a WillPaginate::Collection object.
Does your controller have the other half of the equation, e.g.
#scenario = Scenario.paginate(:page => params[:page]||1)
Alternatively I think you might have a plugin on the server side that is converting your Active Record set into a plain array. I'd need a bit more info to look at that.

Resources