SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vote.rjs doesn't seem to work

    In ch. 7 of the Lenz book, my vote.rjs files looks the same as the downloaded book code but doesn't update the count in the browser nor show the highlight effect.

    I'm using the latest Instant Rails which I think has a newer file system (.html.erb) so I also experimented with .js.rjs rather than just .rjs as per the book.

    The first errors I solved by creating an empty vote.html.erb file in the views/story directory, but the effect and page count update still does not happen.

    When I refresh the page 'F5' the count does show as increased.

    Any help would be much appreciated!

  2. #2
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fixed

    fixed

  3. #3
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    curious what did you do to fix this? I am now having the same issue
    does not auto refresh.
    If I reload the page it works
    Sam

  4. #4
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found it "_" underscore is the culprit yet again!!!!!

  5. #5
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was having the same problem. Tried everything. Underscore was not the solution for me anyway.

    If anyone else is having a problem, I changed "@story.votes_count" to "@story.votes.count" and it worked. "@story.votes.size" also worked.
    Learning Ruby on Rails
    Using jEdit

  6. #6
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What i could have said was on page 190
    under notation
    "This is another method to which we gained access by defining the has_many rela-
    tionship. An alternative syntax that achieves the same result combines the name
    of an associated table (in this case, votes) with _count, like so:1 "
    Bottom of page 190 quoted:
    1
    This technique for counting records is in fact deprecated, meaning that it should no longer be used
    as it will cease to be available in future versions of Rails. However, I’ve included it here for a reas-
    on—we’ll be overriding this method with a database table column of the same name in Chapter 9,
    so we need to create it now. end quoted
    so in place of any further "_" (while in this condition)
    I used "." which in later chapters I was able to quickly resolve.
    -=Sam
    and for whats it worth beware of the yml file entry ""second"/"another""
    entries. in later chapters.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •