Displaying 20 results from an estimated 800 matches similar to: "Getting Index When Using render :partial"
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
2006 Jan 02
2
HTML Fragment not Loading in Firefox; Fine Elsewhere
Ok, this has got me going a bit crazy. I have an HTML fragment being
returned for the result to an AJAX query. It works fine in Safari or
from curl (and even in IE/Mac), but utterly fails to load in Firefox,
even if I point directly to the URL, skipping all that AJAX stuff in
between. (The server logs show a 200 response, regardless of which
browser is being used.) I''ve verified
2006 Jan 09
2
Using SQL to get a whole record when using aggregate functions
I have a table with some data structured something like this:
book
----
title (varchar)
pages (int)
completed_on (date)
While I can find the shortest book completed in each year with
something like this:
select min( pages ), year from book group by year
I would also like to get the title of the shortest book in each year.
Is there any way to do this by modifying the previous query to pull
2006 Jun 02
2
State of the Art in Login?
Hi folks,
I''ve got an older project I''ve used LoginGenerator for. It works pretty
well, but lacks password resetting, etc.
Now I''ve got a new project for a client that''s going to need login
capabilities as well. I''ve been looking at the Salted Login Generator
and the Login Engine, and have taken quick stabs at running through the
installation
2006 Mar 22
7
What is difference between render & redirect methods?
Hi,
Thest are two methods:-
1) redirect_to :action => ''list''
2) render :action => ''list''
what is difference between these two methods??????
Thanks.
Prash
--
Posted via http://www.ruby-forum.com/.
2006 Mar 21
4
render :action => ''list''
does anybody know what the hell "render :action => ''list''" means???
is "render" a method? is :action a parameter?
thanks a lot.
--
Posted via http://www.ruby-forum.com/.
2005 Dec 27
1
Odd Behavior with render
I''d been trying to iterate through an array of hashes using the
ActionController''s render method. Unfortunately, it appears that when
I use a hash as one of the array elements, it gets passed as a nil to
the partial. Here''s some code:
@books = [ ''hello'', ''hello2'' ]
render :partial => "book",
2006 Apr 30
4
Migration, BigInts, and string lengths
Howdy Y''all,
I was thrilled to recently discover migrations, as that framework
addresses a common problem in an elegant way. I have, however, gotten
tripped up a bit as I''ve worked with them.
The first problem I encountered was that, though I was using a BigInt
data type in a field in my dev database, my unit tests were failing
because when I copied the schema from the dev
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
2005 Dec 28
4
AJAX works in Safari, broken in Firefox
I''ve been working on an AJAX search, very similar to the Flickr one
in the screencast linked from the main rails page. I''ve been doing my
testing in Safari, where everything has worked fine, only to now
discover the results of the search action seem disinclined to load in
Firefox. I can enter a URL to return the HTML fragment that''s
supposed to be dropped into
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/.
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
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 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 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?
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
2011 Oct 10
6
Ruby on Rails sqlite3 ranking
I am making a browser-based game using ruby on rails and I am having
trouble implementing a ranking system for my game. Each player has
five skills: intelligence, creativity, strength, charisma and
technological. I want the player to have a rank for each skill. The
ranking I have in place right now gives the same rank if two players
have the same amount of skill.
SELECT COUNT(*) AS [rank] FROM
2006 Jul 20
11
3 columns
Hi all,
Not really sure what to put in the title so hope people still open this!
What I want to do is produce something like this
Col1 Col2 Col3
data1 data2 data3
data4 data5 data6
data7 data8 data9
data.. data.. data..
data.. data.. data..
data-n data-n+1 data-n+2
I can get the data back from my db
2006 Apr 12
4
Binding Text Field/Areas to Array?
Hi,
If I have @answers in my Controller, which is an array of Answer model
objects which don''t exist in the DB yet...
How do I bind a text_area helper in the View to each Answer? (I''m
pre-filling some of the Answers with other data people need to verify
before submitting and will insert on POST.)
I''ve been able to get the textareas to render but not with the