similar to: Multidimensional dynamic Hash

Displaying 20 results from an estimated 20000 matches similar to: "Multidimensional dynamic Hash"

2009 Oct 23
2
validates_uniqueness_of across multiple rows?
Ok, that''s not the best subject line, but I couldn''t think of a concise way to describe what I''m trying to do. I''ve got two models. Grouping simply contains an id and a few other attributes (e.g. rating). A grouping can contain many elements which are stored the Element model. A set of elements is tied together by a grouping_id. An element can be one of
2011 Jan 10
8
Creating a Dynamic/Custom form
I am pretty new at rails and seem to be stuck on an issue. Trying to find a way to get me app admin to create a form on our rails app. These would include: - Select form control type - Select required validation - Select price change if selected How should I even start going at this? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2010 May 12
6
dynamic searchable fields, best practice?
I have a Lexicon model, and I want user to be able to create dynamic feature to every lexicon. And I have a complicate search interface that let user search on every single feature (including the dynamic ones) belonged to Lexicon model. I could have used a serialized text field to save all the dynamic information if they are not for searching. In case I want to let user search on all fields, I
2010 Oct 06
7
Passing a hash from the model to the view
I''m trying to display a drop-down menu by using an instance variable from a model. THIS WORKS... <div class="field"> <%= f.label :duration %><br /> <%= f.select ("duration", {"30 minutes" => "30", "1 hour" => "60"}, :prompt => "Select") %> </div> THIS DOESN''T
2013 May 22
2
Creating nested hash from nested active record results
Hello, I''m trying to find a very abstract and "one size fits all" for converting nested active record results to nested hashes. It''s easy, to do one level deep as such: [code] results_to_hash = Hash[ found_categories.map{ |c| [c.id, c.title]}] [/code] But, when I try to add another collection to the mix, it completely borks and the results_to_hash only returns an
2010 May 31
5
ActiveRecord model relationship with YAML file
Hi, I have an ActiveRecord model Group and a YAML table stored in config/users.yaml just like: - {login: titi, password: 123456, group_id: 2} - {login: toto, password: 987654, group_id: 7} And I would like to link them by a sexy way. Can you help me? I would be happy if I can do this (as example): User.first.group.id # => 2 Many thanks for any help! -- Posted via
2010 Jan 25
3
Dynamic attributes!
I want to create a general model ''Product'' that I will be able to store several attributes in it. For example the attributes :id :name :description are pretty stantard. So each product will have this attributes. However, I wanted to know if it is possible to create dynamic attributes. In the case of a cell phone device I might want to store the IMEI of the phone, this
2010 Aug 03
10
Returning last value
Hi. I have the following controller of the update action: [code] def update @projeto = Projeto.find(params[:id]) if (@projeto.update_attributes(params[:projeto])) ## Mesmo raciocĂ­nio utilizado no create. @permissaoA = Permissao.find(:first, :conditions => ["usuario_id = ?", @projeto.responsavel.to_i]) @permissaoAvancado1 = Permissao.find(:first, :conditions
2010 Jan 15
21
Dynamic Assets - can it be done?
I''m looking for 3 areas to work as dynamic assets: image_path, javascript_path, and stylesheet_path When I say dynamic, I mean that they will be dynamic through controller/models. I have been working through approx. 12 hours of searches to satisfy my answer to this question but am not finding much luck. The closest things I''ve found enabling this are use of config for assets
2011 Jan 19
6
rake aborted! can't convert Hash into String
Hello, I encouter a problem when i try to do "rake db:migrate": rake aborted! can''t convert Hash into String Here is the trace result: ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! can''t convert Hash into String /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1408:in
2009 Oct 17
2
Skip default_scope when running migrations
Hi, I was wondering if there is a way to skip the application of a named_scope to calls made in legacy migrations. I am working with some old migrations that include some data manipulation tasks, and my default scope is preventing those migrations from running. I''m trying to avoid editing those migration files with with_exclusive_scope. Thanks, -G -- Posted via
2006 Jun 14
5
Converting Hash to and from URL params
I''m sure this is easy since rails does this internally, but I need to convert a string of url formatted variables "foo=bar&baz=snoo&why=because" to a hash, and I need to convert a hash to url format. Now before I roll my own methods to do this, does rails expose this functionality somehow? -- Posted via http://www.ruby-forum.com/.
2011 Aug 29
32
Weird assignment problem, very confused :(
Hey, I have the following line in my controller: User.create(:email => "fuuu-+RB1Aph5k6s@public.gmane.org", :password => ''asldfkjadsfadsf'', :ip => request.remote_ip) my IP is 127.0.0.1 - now User.find_by_ip(''127.0.0.1'') returns 0 records although User.first contains ''127.0.0.1'' if I change it to: User.create(:email =>
2010 Dec 20
11
rails code to sql
Is there a relatively easy way to do this code in sql? @categories=Category.all.reject{|n| n.blank?}.sort{|a,b| a.name <=>b.name}.collect{|t| [t.name,t.name.downcase.gsub('' '',''_'')]} -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2011 Jan 06
14
Forceing PUST vs. POST in form
I am experimenting with a combined form. I wish to force the HTTP verb for this form to PUT. However, it always uses POST when submitted and I cannot determine why. The view template code is: <%=form_for( @user, :html => { :class => :edit_user_role, :id => :edit_user_role_form, :method => :put }, :url => user_roles_url( @user ) )
2010 Jun 14
7
"NoMethodError in AdminController#index" error
hi, im totally a newbie so i have got no idea whatsoever why i got this error, the thing that happend was i was doing a little coding along with the lynda.com rails series that i got this error. well as u can see this is the error which i get on terminal, but there is another one in browser too which says : "NoMethodError in AdminController#index " u can see it in the picture here :
2010 Aug 16
8
Executing js.erb file with :format =>'js'
Hi, I''m trying to get my javascript to execute after clicking a link on my page using :format => "js" here''s my link: <%= link_to image_tag("/images/icons/user_add.png"), add_contact_path(:profile_id => profile.id, :url => request.url, :format => "js"), :title => "Add person to your contacts"%> in my controller i have
2010 Dec 21
8
Rails - escape_javascript without all the \n\n\n\n\n
Hello, I''m using escape_javascript to return a partial to the browser via ajax. Something like: $("#inject").html("<%=escape_javascript(render :partial =>"feed/ index")%>"); Problem is escape_javascript ends up outputing all kinds of wasted space like \n\n\n\n\n \n Is there anyway in Rails to escape_javascript more
2010 Jan 12
8
tips on how to write a controller test for models associated with currently logged in user
I have a controller test here: http://gist.github.com/275616, which works fine when account is an independent model, however I want: an account to be a property of user, ( and created and associated when a user is) when the user goes to /account/edit it should on edit the account of the logged in user - I can make rails do this, but I''m utterly baffled how I should alter this test to
2010 Jul 20
20
render :js => "alert('Test !')"
Hi Folks, I use render :js => "alert(''Test !'')" in my modele, but instead of having the alert displayed, the browser try to donload a file containing this string : <<render :js => "alert(''Test !'')">>. Do you know why I the browser behaves such a way ? Regards -- Posted via http://www.ruby-forum.com/. -- You received