kaminari(0.13) and haml (3.1.4) - ruby-on-rails-3

How to solve kaminari problem with haml? I m using haml haml (3.1.4)
and kaminari 0.13.
my index file looks like:
%h1 Listing customers
=paginate(#customers)
%table.index-list
%tr
%th Name
.....
but i m getting an error
undefined local variable or method `prev_span_tag'
for #<Kaminari::Helpers::Paginator:0xa848978>
Extracted source (around line #10):
7: paginator: the paginator that renders the pagination tags inside
8: -%>
9: <%= paginator.render do -%>
10: <nav class='pagination'>
11: <%= current_page > 1 ? prev_link_tag : prev_span_tag %>
12: <% each_page do |page| -%>
13: <% if page.current? -%>
Thanks.

I found this question : Rails heroku help kaminari view error. So i'd delete (and backup if necessary) your current views and regenerate them again

Related

devise error on rails 3

Im getting the following error message:
undefined method `user_registration_path' for #<#<Class:0x10f227cd8>:0x10f5f6d50>
Extracted source (around line #3):
1: <h2>Sign up</h2>
2:
3: <%= form_for(resource_name, resource, :url => registration_path(resource_name)) do |f| %>
4: <%= f.error_messages %>
5: <p><%= f.label :email %></p>
6: <p><%= f.text_field :email %></p>
I checked everything and i didnt found an error, i had just created the project and installed the plugin.
I was using a old version of the devise plugin in the new version of the ror. =x

Error when using a forked gem (active_admin) from Github

I'm experiencing a really weird issue. When I fork the active_admin gem and use the forked, unchanged version it gives me the following error:
Sprockets::CircularDependencyError in Active_admin/devise/sessions#new
/Users/Victor/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-916ecdd04e3c/app/assets/javascripts/active_admin/base.js has already been required
Extracted source (around line #12):
9: <%= stylesheet_link_tag style.path, style.options %>
10: <% end %>
11: <% ActiveAdmin.application.javascripts.each do |path| %>
12: <%= javascript_include_tag path %>
13: <% end %>
14:
15: <%= csrf_meta_tag %>
When I use the original version there are no errors. How is this possible if the two versions are identical?
Yes.you can remove the line
//= require_directory ./
in
/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-916ecdd04e3c/app/assets/javascripts/active_admin/application.js
Remove active_admin.js from your app/assets/javascripts folder - it looks like it is no longer needed.

Rails 3.2 app: undefined method `klass' for nil:NilClass for a Class that exists and renders on page just fine

I am running a pretty straight forward Rails 3.2 app on Dreamhost (I know its lame).
The error is:
NoMethodError in Products#edit
Showing /home/emeraldcityguitars/emeraldcityguitars.com/releases/20120318040051/app/views/products/edit.html.erb where line #47 raised:
undefined method `klass' for nil:NilClass
Extracted source (around line #47):
44: <div id="interior_sub_head"><h5 id="sub_green_head"><%= #product.title %></h5></div>
45: <div id="interior_pad">
46:
47: <%= nested_form_for #product, :html => { :multipart => true } do |f| %>
48: <%= f.error_messages %>
49:
50: <fieldset>
It sounds like #product is returning nil, but if you look at line 44, it didn't error when requesting #product in that case?
any ideas?
EDIT
Full Product#edit view: https://gist.github.com/2081340
+
_photo_fields.html view: https://gist.github.com/5af2f88f29c21e24b42c
Thanks
I had the same problem and I made two changes, unfortunately not separately, and one or both solved the problem.
First, in your controller do you build a photo in your edit method?
#product.photos.build if #product.photos.empty?
I found that in the comments on this blog post.
Second, I added a symbol for the nested class to the 'link_to_add' line, which you already have.
I was switching from a has_many to has_one and was getting this same error. Azolo's response fixed my issue.
Removed the <%= f.link_to_add......%> tag and all is working nicely!

Why can't I access this field? (Rails 3)

I really can't figure out why I can't access the user_id field for the class Post. I have it as a field in my database (I can see it, and it isn't blank. Yet for some reason, I'm getting this error:
undefined method `user_id' for #<Class:0x103497448>
Extracted source (around line #10):
7: <h2>Topics</h2>
8: <% #board.topics.each do |topic| %>
9: <% #post = topic.posts(1) %>
10: <b><%= User.find(#post.user_id).username %> says <%= link_to topic.subject, [#board, topic] %></b><br />
11: <% end %>
12: <% end %>
13:
topic.posts(1) will return an array. Hence #<Class:0x103497448>
The right way to get the first post for a topic would be
9: <% #post = topic.posts.first %>
10: <b><%= User.find(#post.user_id).username %> says <%= link_to topic.subject, [#board, topic] %></b><br />
Try <% #post = topic.posts.limit(1) %>

devise + omniauth undefined method `find' for Symbol:Class error

NoMethodError in Projects#index
Showing /home/dave/Documents/exercises/todo/app/views/layouts/application.html.erb where line #18 raised:
undefined method `find' for Symbol:Class
Extracted source (around line #18):
15:
16: <div id="container">
17: <div id="user_nav">
18: <% if user_signed_in? %>
19: Sign in as <%= current_user.email %>. Not you?
20: <%= link_to "Sign out", destroy_user_session_path %>
21: <%else %>
why am i getting this error message?
undefined method `find' for Symbol:Class
im using rails 3.0.7 and devise 1.1.rc0
based on this tutorial http://media.railscasts.com/videos/236_omniauth_part_2.mov
what a lame i just bundle installed devise 1.3.4 and changed secret_token or clear sessions db and *then up and running*
just incase some people might investigate some the cause of this problem just to let you know.