similar to: Values broken converting from rails into javascript

Displaying 20 results from an estimated 2000 matches similar to: "Values broken converting from rails into javascript"

2006 Feb 28
6
Problem with select and each_with_index
Disclaimer: Ruby newbie at work Thought I was going so well. Wanted to produce a select box from an array constant, with the indices returned as values , and the array values used as the descriptions. Checked out Ruby RDoc and saw there was an each_with_index method and came up with: <%= select (''type'', ''typecategory'', Typecategory.each_with_index
2006 Apr 03
2
Fast way of finding new position for model object?
I have a model object that acts as a list. The position of each object is determined by two factors: number of votes ascending and age of object descending. When a user adds or deletes a vote I need to quickly update the associated model object''s position. Right now this is done with the following method: def update_position position = nil Bug.find(:all, :order =>
2006 May 12
1
each_with_index. Can you start at a desired index position?
When using array.each_with_index how do you start at a desired index position? I can do it like this, but its not very clean and doesnt seem efficient : desired_index_start = 20 array.each_with_index do |value,index| next if index<desired_index_start end Thanks Chris -- Posted via http://www.ruby-forum.com/.
2006 Apr 19
2
Ferret EOFError creating index
I''ve been messing around with Ferret (no punn intended). After spending some time testing it out (indexing to file), I decided to index about 10% of the data I want to eventually index. It took several hours to complete the index on my local machine, but it was created without any problems and after optimising it the searches returned results at the sort of speed I was expecting. I
2007 Jun 07
1
Lost login process PID XXXXX
Dear List: We installed Dovecot v1.0.0 a couple days ago. After running the software for a couple days, the following happened: Jun 6 15:58:10 cello dovecot: POP3(sgtdohara): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0 Jun 6 15:58:10 cello dovecot: POP3(dorene): Disconnected: Logged out top=0/0, retr=1/4652, del=1/1, size=4635 Jun 6 15:58:10 cello dovecot: Lost login process
2006 Jan 02
3
Re: Getting Index When Using render :partial (Benjamin Stiglitz)
Thanks for the suggestion, Ben. This seems an excellent approach to the problem, except that I''d been under the impression that one could only call render once. If you call it multiple times as the each_with_index loop iterates, are the results just combined automatically? How does that work? Thanks! Sean ----- Sean McMains AIM: SeanMcTex http://www.mcmains.net/ruminations On
2008 May 21
2
Schedule write errors?
My BackgrounDRb server intermittently bails out with the following exception in the middle of a long running task running on a Worker sub classed from BackgrounDRb::MetaWorker (the point at which it raises this exception is different each time it runs) /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:145:in `schedule_write'': You have a nil object when you
2009 Apr 30
1
error with test:functionals
Hello there, I working on my tests but I getting this strange errror: I can see on the database that the object was created but I still got an failure on my test. this is my test code: test "should create artist" do assert_difference(''Artist.count'', difference = 1) do post :create, :artist => { } end assert_redirected_to
2006 Jan 02
2
Getting Index When Using render :partial
I''m using a web service to retrieve an array of results to a search and a render :partial to display those results to the user, while at the same time putting the results into the session. Is there a way for my _book.rhtml file to have access to the index of the result currently being displayed, like each_with_index makes available to its block? This would allow me to have the
2009 Jul 16
9
Please help me understand how arrays are translated in rails
I''ve spent hours researching the subject and have tried many test sequences in IRB, and rails console but I''m just having trouble making headway into what is probably a very easy subject. I understand arrays with at least 4 other languages but with Ruby I haven''t found a mental connection with how I can assign variables to arrays.. Take for example: def
2011 Dec 07
4
what is "private method `split' called for nil:NilClass" error??
Dear all, I have this line: <% $c_repo.split('','').each_with_index do |repo, i| %> in one of my template files and on the target node I''m getting this error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template zmfs/zmfs_prob.erb: private method `split'' called for nil:NilClass Any idea what am I missing?
2007 Apr 18
2
Checking validity of NHS numbers
Hello I need to check that the NHS numbers in my database are valid. I''m storing them as ten-digit strings: the first nine are the identifier and the tenth is a check digit. There are four steps to calculating the check digit (from http://www.connectingforhealth.nhs.uk/systemsandservices/nsts/docs/tech_nn_check_digit.pdf): 1. multiply each of the first nine digits by a weighting factor
2011 Dec 22
0
mongodb Map/reduce grouping
Hi, I have two model, challenge(embeds_many :tasks) and task(embedded_in :challenge), finally database structue is like this { "_id" : ObjectId("4db8b0524f0b495c3a7dbba4"), "title" : "Testing1", "created" : ISODate("2011-12-12T00:00:00Z"), "tasks" : [ { "name" : "task no 1",
2007 Feb 28
3
[ win32utils-Bugs-8942 ] several typo in windows-pr.
Bugs item #8942, was opened at 2007-02-28 23:59 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=8942&group_id=85 Category: windows-pr Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Katsuyuki MIYAMUKO (miyamuko) Assigned to: Nobody (None) Summary: several typo in windows-pr. Initial Comment: I found typo in windows-pr. Attached
2006 Apr 14
2
spot the error (I can''t, I''m new)
I have a form that I want to use to update multiple objects. In the controller, @grades = Grade.find(params[:grade].keys) @grades.each_with_index do |grade, i| grade.update_attribute(params[:grade][i]) end all_valid = @grades.inject(true) {|memo, c| c.valid? && memo } this doesn''t update the attributes as I would expect. (I would just use
2005 Dec 21
1
Are Ducks Hibernating ?
Dears, Remembering last value in a select box don''t work for me as : Controller : @years=(1970..2005).to_a Form: <%= select_tag "year", options_for_select( (2001..2005).to_a, @params[:year] ) %> I had to write <%= select_tag "year", options_for_select( (2001..2005).to_a, @params[:year].to_i ) %> for it works. Not important, but I''m
2013 Jan 30
2
Installing fog -0.7.2 for CloudProvisioner
Hi, I am trying to install fog which is required for cloud provisioner. > gem install fog -v 0.7.2 I am getting the following error Building native extensions. This could take a while... ................ ERROR: Error installing fog: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb creating Makefile make
2006 Jun 26
0
options_for_select-how to store cookie selected value ques.
#Controller cookies[:state] = state if state != nil and state.to_i != -1 conditions << ''stateid = ?'' cond_args << state cookies[:state] = state end if !cookies[:state].blank? @default_state = cookies[:state] else @default_state = "" end # view - html
2008 Mar 14
0
problem with rjs and marker group
Lo there all, i have a function that builds a bunch of markers to go on a google map. I would like to update them with rjs. Here is what i have so far. def map_main_layout @zoom = params[:zoom].to_i @zoom = 14 if params[:zoom].nil? @map = GMap.new("map_div") # @map.control_init(:large_map => true, :map_type => true) # (inserts map control) # place
2012 Sep 01
4
Basic Paypal
Hi all i am following this like for basic paypal http://railscasts.com/episodes/141-paypal-basics and i got this error View: <%= link_to "Checkout", @cart.paypal_url() %> undefined method `paypal_url'' for nil:NilClass despite i have this code in my model called Card Cart Model: class Cart < ActiveRecord::Base def paypal_url(return_url) values = {