Giter Club home page Giter Club logo

Comments (7)

ljachymczyk avatar ljachymczyk commented on July 28, 2024

Hello,

Are you sure following is included in your controller?

include SmartListing::Helper::ControllerExtensions
helper  SmartListing::Helper

from smart_listing.

wsouto avatar wsouto commented on July 28, 2024

I'm including these lines in the application_controller.rb. I tried in the specific controller too and still got the error.

Since I'm just trying it in a new app, it's not hassle to start over, so I'll go to do that tomorrow and watch carefully all my steps and see for sure if I'm not doing something wrong. I'm closing this issue for now until I got sure if it's me or not. If can't figure it out I'll post every step and the app to reproduce the error too. I'm in the latest Rails 4.1.1 by the way, if that matters.

It's a wonderful gem and really handy I hope I can use it because I have a use case that it just fits... Thank you for this nice gem and keep up with the good work!

from smart_listing.

wsouto avatar wsouto commented on July 28, 2024

So, I'm having a hard time trying to figure this out. I started from scratch and keeping having this error because of the <%= smart_listing_update :users %> in the index.js.erb.

I have this in the controller:

class UsersController < ApplicationController
  include SmartListing::Helper::ControllerExtensions
  helper SmartListing::Helper

  def index
    smart_listing_create :users, User.all, partial: "users/list"
  end
end

I did everything else like the instructions. I'm for sure missing something. If I remove the call for <%= smart_listing_update :users %> in the index.js.erb the list works, but I'll be missing features. I've pushed an app to Github that shows the error in case you want to take a look. You can clone it from:

https://github.com/wsouto/smartlisting.git

I just initialized a new Rails app with rails 4.0.5 (I tried also and first with 4.1.1) and follow the steps on README here on Github.

Please, again, sorry if I'm doing something wrong but I just can't figure out... Any help will be thankfully apreciated and I'm really looking forward to use your gem.

Thanks in advance.

from smart_listing.

marostr avatar marostr commented on July 28, 2024

I looked at your code. First of all, add

//= require smart_listing
to your application.js
and the most important, move index.js.erb from app/assets/javascripts to app/views/users.

from smart_listing.

wsouto avatar wsouto commented on July 28, 2024

Thank you very much @tolhaje !

So the move of index.js.erb to app/views/users did the trick.

I'm aware of the //= require smart_listing, I just messed up too much with the app and removed it hoping for more errors messages that could give me more hints... Sorry about that.

Closing for good now.

from smart_listing.

wkurosawa avatar wkurosawa commented on July 28, 2024

I was getting same error on my application, I know that this is due to my lack of information, but, also documentation requires you have a prior knowledge about how Rails handle AJAX requests and responses. And I should, of course.

@wsouto I guess the reason why you need to move index.js.erb is because this is like response of User#index method when called with AJAX, so users_controller.rb will look for a js file on views folder.

Am I right?

from smart_listing.

wsouto avatar wsouto commented on July 28, 2024

@wkurosawa You probabilly are. I just didn't have a clue that we could put js files in the views folder since we have all that asset pipeline and specific folder for javascript files... A simple note in the docs telling newbies like me about where to put this particular file could've helped a lot. But it's a newbie way to think. The name of the file itself is a clue, right?

from smart_listing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.