similar to: Need advice on code-like columns

Displaying 20 results from an estimated 3000 matches similar to: "Need advice on code-like columns"

2006 Aug 13
2
Arbitrary "Columns" for ActiveRecord
I''m having a bit of a tough time coming up with a good solution for what I''m trying to do. I''ve come up with a couple of solutions that work pretty well but many use way too many queries or are just not very good. Basically I want to store something of a property list for a model. class Model < AR has_many :properties, :dependent => :delete end class
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
Has anyone else ran into this? debug: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content: Executing ''diff -u /var/tmp/facts.yaml /tmp/puppet-file20121214-13448-933j3r-0'' notice: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content: --- /var/tmp/facts.yaml 2012-12-14 00:53:20.000000000 +0000 +++ /tmp/puppet-file20121214-13448-933j3r-0 2012-12-14
2012 Dec 03
4
Unnecessary changes when creating facts.yaml
I have set up puppet to create a facts.yaml file for mcollective using the following line: content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime.*|timestamp|.*free|macaddress.*|ipaddress)/ }.to_yaml %>"), However, it is creating a lot of unnecessary changes by reordering the facts in the yaml output as you can see in the diff output between to
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi, in the past few months someone posted an entry on their blog about how to do validations in non-AR classes and I cant find it any more. Anyone have a link? Thanks, Trevor -- Trevor Squires http://somethinglearned.com
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
Hi, I want to use a file resource to write a facts.yaml file for Mcollective. For some reason it won''t provide a valid yaml format if I dump my scope to hash and convert to_yaml. file { "/etc/mcollective/facts.yaml" : owner => root, group => root, mode => 400, loglevel => debug, #content => inline_template("<%= scope.to_hash.reject {
2011 Dec 20
1
read.px() no lee algunos archivos pc-axis
Hola: Posteo este asunto en la lista porque me consta que los "padres" del paquete pxR (por el que les estoy enormemente agradecido) son asiduos de ella y nos aclaran a muchos novatos como yo un montón de dudas de R. Si prefieren que tratemos este asunto de forma menos "publica" no tienen mas que decirlo. Bueno al turrón (nunca mejor dicho)!!! Estoy montando una serie de
2006 May 10
12
how best to implement lookup table?
Hi all - I''d like to implement a lookup table in my app that contains some reference data, just some status codes and their descriptions. What''s the most appropriate approach according to the "rails way" of doing things? Would I just implement a has_many relationship? Let''s say these are Order status codes, would the StatusCode have many Orders? This
2011 Feb 02
11
How to include the Scope(...) in a generated string?
I''d like to include similar information that notice() spits out in a file I am generating -- basically so that anyone looking at the generated file (actually a file fragment) could trace it back to the class that is generating the entry. Using $name within the file fragment is the closest I am getting to what I want -- is there anything better? -- You received this message because you
2007 Dec 13
1
Merb::RenderMixin#set_status refers to non-existent RESPONSE_CODES constant
#set_status http://merb.devjavu.com/browser/trunk/lib/merb/mixins/render.rb#L270 refers to a non-existent constant. I tried, while creating #359, to make things OK, but I failed. I started by using STATUS_CODES instead, then used #[] instead of calling a method named STATUS_CODES, then I found out that during the call to #inherited
2006 Jan 26
2
Easy way to add properties to a model?
Hi, I have a model (let''s say User) and I would like to add any number of user-defined-settings to this Model. I created a UserSetting Model with user_id, key and value. I connected them with has_many. I know how to access these properties from a user but I would like some methods like user.hasProperty? / user.getProperty ... I think I know how to write these methods/finders myself but
2011 Nov 04
2
problem with templates
I am having an issue with templates that I cant quite figure out why it is having an issue. I am using ruby dsl to read a template from a database and it keeps having problems with anything other than <%= var %> type definitions. I even went as far cutting and pasting from the puppet online documentation just to see if it were maybe something I goofed. I pasted below the tested template
2006 Jul 26
4
Execute code when an inheritance happens, or disabling STI
I am trying to inherit from a ActiveRecord class defined in a plugin. The problem is that ActiveRecord thinks I am doing an STI and is looking up a table that doesn''t exist. Currently, I have a method in the parent class that looks like this: def self.fix_table_name class_eval do set_table_name(Inflector.tableize(self.to_s)) end end The problem is that this method
2006 Apr 11
11
I can''t get rails to see my plugin. How can I this?
I''m trying to produce a plugin to help me with my page caching woes. I can''t seem to get rails to see my method within the plugin. This is my first attempt at a plugin so I''m sure I''m missing something. I''ve created a directory /vendor/lib/plugins/broom_stick/. I then created an init.rb file with: require ''broom_stick'' I then
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi, I''m a bit stuck with mocking a unit test of a join model with regards to a validates_uniqueness_of clause. I have class Book < AR:B has_many :clippings various validates_presence_of etc end class Clip < AR:B has_many :clippings various validates_presence_of etc end class Clipping < AR:B belongs_to :book belongs_to :clip validates_uniqueness_of :clip_id,
2008 Jan 08
1
odd facter error with split
Not sure if this is another issue cropping up with 0.24.1 but I''m getting the following: info: Loading fact raid /etc/puppet/facts/location.rb:5: private method `split'' called for nil:NilClass (NoMethodError) from /usr/lib/ruby/site_ruby/1.8/facter.rb:510:in `call'' from /usr/lib/ruby/site_ruby/1.8/facter.rb:510:in `value'' from
2006 Jun 01
3
rake create_sessions_table, does not create session table
when i run rake create_sessions_table, I get following output. tables donot get created and my application doesnot start. (in G:/rubysrc/blog) create db/migrate create db/migrate/001_add_sessions.rb info: the first time ran take everyting was fine, but now i have reinstalled ruby and rails and created the database, but i am unable to create session table with rake, please help.
2007 Dec 10
10
Reading Hash/Array
Hi all, My app is generating a form with several bill_items that should be updated (fields to be updated are description and net). The text_field_tag names are bill_item[update][#{id}][description] and bill_item[update][#{id}][net] (and I added bill_item[update][#{id}] [id] just in case) The param received is: {"commit"=>"Save",
2005 Dec 08
2
bounce effect
Hi, I was wondering if anyone has seen (or completed) an effect to make something ''bounce'' like icons do in the OS X dock when you launch them? Something that looks like there''s a bit of gravitational behavior to it? Thanks, Trevor Trevor Squires http://somethinglearned.com
2007 Dec 01
5
specifying an HTTP status code
Hi all, I''m just starting to work w/ RSpec, so I hope this question isn''t too obvious or missing the point somehow: Is there a way in RSpec to specify that a controller action should use a specific HTTP status code? Specifically I want to test for the usage of 301 as opposed to 302, for a permanent redirection. response.should be_redirect looks like it calls
2006 Oct 30
3
Question about new results hash
Is it really a hash? As in, can I pass it into a method that a worker is calling so that, for example, a method in my ActiveRecord that''s actually doing the work? Really liking the new code. Does rubyforge or devjavu have the rdocs anywhere? -- Joshua Warchol Code Poet, Zaadz Inc. http://joshua.zaadz.com/