SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Variable Issue

  1. #1
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    16
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Variable Issue

    Hi, I have an issue with a variable creating an array...

    First, I initialize the array.
    Code:
    @data = []

    Then I add the data.
    Code:
    @data << [...]
    Then I display the results
    Code:
    <% @data.each do |data| %>
    It works great... but if I change the variable name to @x it fails and display an empty array...
    I dont understand why.
    Any help please?

  2. #2
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    16
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Done.
    I had to restart the server..
    The weird thing is that Im in development environment...

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,113
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    You should only need to restart the server if the code is an an initialiser that's run when Rails is booted.
    Any regular code in the /app directory will get run every time a page is loaded.

  4. #4
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    16
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ohh, thanks, thats why then...
    Im creating my functions in /lib


Tags for this Thread

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
  •