Displaying 20 results from an estimated 3000 matches similar to: "how to pass a hash as a parameter in link_to_remote"
2006 May 05
1
Sorting a hash
Quick Prototype.js hash question.
Given:
MyHash = {"Alpha" : {name:"Foo",val:3},
"Delta" : {name:"Bar",val:2},
"Beta" : {name:"Baz",val:4} }
I want to display this set ordered by key - Alpha,Beta,Delta and by
val - 2,3,4
Prototype.js helps with the hash:
$H(MyHash).keys().sort() will give me Alpha, Beta, Delta
but I''ve not
2006 Apr 09
1
http request, hash table
Hello,
My problem is that I cannot figure out how to format data in the http
post request
using external C++ application, so then I could write in my controller:
@myHash = params[:person]
print ''Name: '', @myHash[:name]
or
@name = params[:person][:name]
Thanks in advance!
--
Jakub P. Nowak
2011 Feb 27
10
How to store the same key multi times in a Hash ?
given an Arra tags[]
I need to produce a resulting Hash as following ..
{ "$in" => [tags[0]], "$in" =>[tags[1], ...}
in which the key should be always the same and the value being an
Array
I tried this :
myHash = {}
tags.each do |tag|
h = {"$in" => [tag]}
myHash.merge!(h)
end
but the merge! is only
2016 Dec 01
0
clang error: static_assert failed "Cache the hash code or make functors involved in hash code and bucket index computation default constructible"
Hi,
Consider below test case:
1 #include <unordered_map>
2
3 using key=const int;
4 struct Myhash {
5 Myhash() = default;
6 std::hash<int> hash_int_t;
7 inline size_t operator()(const key& x) const throw() {
8 return hash_int_t(x);
9 }
10 };
11
2010 May 30
4
Data Frame as Hash Table
I'm interested in using a data frame as if it were a hash table. For
instance if I had the following,
> (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6)))
key value
1 0.5 -1.118665122
2 1.0 0.465122921
3 1.5 -0.529239211
4 2.0 -0.147324638
5 2.5 -1.531503795
6 3.0 -0.002720434
Then I'd like to be able to quickly retrieve the "value" of "key" 1.5
2006 May 18
3
Two-Dimensional Hashes through links?
I''m really hitting a wall here. My program has a search engine, returns
a list of results. I am using a two-dimensional hash to pass the form
data back to my controller. (i.e. params[:job] => {:description =>
"xxx", :location => "xxx", company => "xxx"}) I use that Job object to
search my database, and then wait for user input.
Now when the
2006 Jun 18
4
share an hash ..
Hello,
How to share an Hash between all objects (model, controller ect ...)
=> I did a static Hash in my model where a static method fill it
basically, this is the code
class Person < ActiveModel
@@anHash.new
def Person.anHelperMethod(aKey)
if anHash.size==0
... load the hash, some SQL to fill the Hash
end
return anHash[aKey]
end
=> The problem,: it always
2006 Jul 10
11
prototype hash method
var v1 = {
a: ''value for a'',
b:''value for b''
}
var v2 = {
c: ''value for c'',
d: function(){some code...}
};
var v3 = v2.merge(v1);
I''m getting an error doing this...
what is wrong?
2006 Jun 07
2
Hash flattening on paginator link_to
Hey
I need some help with pagination and the link_to in the view.
I''m trying to include a hash in the pagination link_to params and it
keeps flattening out my hash.
Example:
Here''s my hash called @answer:
"answer"=>{"6"=>"9bf31c7ff062936a96d3c8bd1f8f2ff3",
"7"=>"6f4922f45568161a8cdf4ad2299f6d23"}
2011 Jan 26
1
[PATCH] Display verbose error message when guest storage isn't found
Unfortunately libvirt will not always return volume information for a guest's
volume. Specifically, it will not return volume information if the volume is not
in a storage pool. Rather than displaying a generic libvirt error in this case,
advise the user how they can create an appropriate storage pool.
Fixes RHBZ#672498
---
lib/Sys/VirtV2V/Connection/LibVirtSource.pm | 27
2005 Dec 14
3
Advanced routing question.
Hello All,
I''m making a quick application that tracks outgoing links to referral
sites. I need to track the user and the url they went to so the
easiest way would be to take the entire url as a parameter and log
that into the database. I was wondering if I could do something like
this with routing:
http://www.example.com/user/jump/http://www.myvendor.com/referral.php?
2008 Dec 13
2
Need Help in converting php encryption decryption code to ruby on rails
Hi guys i found this encryption decryption in php and try to convert
it in rails but i am unable to successfully convert it. So plz help
me. I you write the whole conversion code then it will be great.
PHP code is like this
================
#
#/**********************************************
#**
#** MD5 block cypher
#**
#** Author..: leapinglangoor [
2006 Jan 24
2
collect array values
This may be more of a Ruby question, but I wasn''t sure.
Is there a way to run a find on a model and then save two fields as
key => value in an array for each row. Then use this array on the
template for checking if various checkbox or select values are
checked? I''m trying to avoid running one query to check the value for
each box in the form.
- Kyle
2023 Mar 18
2
Custom SASL authentication
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20230318/8ce3c29a/attachment-0001.htm>
2008 Nov 03
3
MS-SQL deliveres binary image as array
Hello!
I need to display images stored in a MS-SQL database but I get the
following error:
NoMethodError (undefined method `unpack'' for #<Array:0x48cbff0>):
c:/ruby/lib/ruby/1.8/base64.rb:59:in `decode64''
I guess its because MS-SQL delivers an arry...
Is there a solution to this problem??
Please help me!
lacky
--
Posted via http://www.ruby-forum.com/.
2006 Jan 15
1
Cloning a one-many association
Hi, I want to make a copy of an object with its associations, and I am
looking for an elegant solution. This is what I intuitively think should
work, but it doesn''t:
order2 = order1.clone
order1.line_items.each do |o|
order2.line_items.build(o)
end
This doesn''t work because a model class does not stringify its keys ...
so I can''t pass an object into a method that
2006 May 24
6
newbie question: missing template
Hi
I''m new to this forum and new to Rails so excuse me if this is a daft
question.
I''m following the ONLamp.com tuturial and all has been well untill
changing the template for the recipes. I have followed the instructions
and added this code to the controller:
class RecipeController < ApplicationController
scaffold :recipe
def list
@recipes = Recipe.find_all
end
2006 Feb 16
0
RE: Applying list-item format depending on action (Diego Scataglini)
Seth,
It really depends how often you do that check.
If it happens only once or twice in your whole application, that''s just
fine.
If it happens more than that and in multiple controllers/views then maybe
you want to create a helper for it.
Something like this: (didn''t test it, but should be working)
module ApplicationHelper
def current_id_select(controller, action)
(
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello,
I''m having a problem utilizing the find_all method with a value from a
form. I keep getting the following error:
Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'':
SELECT * FROM items WHERE (category_id11)
The controller seems to be getting the correct data, but my key and
value seem to be mashed together(it''s
2006 Apr 22
2
put variable in session each time any controller runs?
Hi -- well, that''s what I''m trying to do. Does anyone know what the
best way to do it is? I have three controllers, each one has a hidden
tag, and I want each one to salt its respective tag with the name of
the action in effect, at the time that action runs, for every action
in the controller.
--
Giles Bowkett
http://www.gilesgoatboy.org