search for: my_class

Displaying 17 results from an estimated 17 matches for "my_class".

2009 Apr 08
4
Having trouble extending a class from a Rails plugin
...some methods to the class, but, I can''t seem to get Rails (2.2.2) to pick-up the extended definition. I did find while trying to debug the problem that if I paste the extended definition into, say, environment.rb it works fine. Also, if I require_dependency "#{RAILS_ROOT}/app/models/my_class.rb" in the plugin''s version of the class it also works fine (obviously not desirable). All of this leads me to believe that my problem has something to do with the class loader, but, I can''t figure it out. I''ve laid out an example below that illustrates my problem....
2006 Feb 16
3
Retrieve a property defined in a css
Hi all, I have a property, defined in an external stylesheet: .my_class { background-color: #FF0000; } I want to retrieve the value of this background-color of the class my_class. How can I do that with prototype/scriptaculous ? Thanks in advance, Nicolas Terray
2007 Jan 12
2
Forking a process in Rails is messing up mongrel
I''m trying to run an external Ruby script from my Rails app. To do this i''m using this function def fork_with_new_connection(config, my_class = ActiveRecord::Base) pid = fork do begin my_class.establish_connection(config) yield ensure my_class.remove_connection end end Process.detach(pid) end Then, within my controller I do this: # fork a process config = ActiveRecord::Base.remove_c...
2006 Dec 17
12
Best practices for conditional display in views?
Hi. I am writing an application that has a lot of boolean conditional display logic, like this: <% if user.description then %> <p class="css_class"><%= user.description %></p> <% end %> Often the displayed content is more complex than the above, and to clean up my views I am trying to pull a lot of this sort of thing into partials. However, the problem
2006 Mar 30
0
design question - user data from two different sources
...suggestion of some pattern of organising these models. What I''ve come up with so far are 3 classes - DbPerson and LDAPPerson, and a Person class which is supposed to be something like an interface. It has an if clause that checks the USE_LDAP constant. Depending on this test it sets a @my_class variable. Then it defines wrappers to all the common functions of the two models and calls the methods of the relevant model by using the @my_class var. This works but it seems clumsy to me so I''m looking for insights :) Thanks! -- Agnieszka -- Posted via http://www.ruby-forum.com/.
2006 Feb 26
1
Help with ruby=>html
Hi! I''m new to ruby and rails and got problems with using basic methods like form_tag or link_to etc to create what i need, i.e. to specify css class or id or name of html elements. I have problem with understanding rails api (it''s just as an example): form_tag(url_for_options = {}, options = {}, *parameters_for_url) what parameters can i pass to form_tag? How to specify
2013 Feb 22
0
Custom utils lib
Hi all, Is it possible to have a custom utils lib in puppet ? By exemple I want to have a custom class used in many custom facts and many custom function : module_utils/lib/puppet/my_class.rb And in my custom fact I can call this class : > require ''module_utils'' Facter.add("custom_fact") do > setcode do > var = Puppet::Utils::my_class.getVariable() > end > end Loïc -- You received this message because you are subscribed to the...
2013 Oct 13
2
LAMP stack with strange dependencies
Hello everyone. I''ve been toying around with puppet and something happened that seems strange to me. In site.pp I have the following: > node default { > > # This is where you can declare classes for all nodes. > > # Example: > > # class { ''my_class'': } > > # class { ''lamp'': } > > package {''php'': > > ensure => present, > > before => File[''/etc/php.ini''], > > } > > >> file {''/etc/php.ini'': &gt...
2011 Oct 11
1
recursive finds
...ould have to get a listing of all of the puppetclasses within the chain of Hostgroups to which ServerA belongs. So this is my code... @hosts.each do |host| @ancestors = Hostgroup.find(host.hostgroup.ancestry) unless host.hostgroup.ancestry == nil @ancestors.puppetclasses.each do |anc| @my_classes[anc.name] += 1 end end And this works for me because I am only nesting 1 level but it''s conceivable that other users would nest many more levels and if my patch is to be accepted, I undoubtedly have to account for an infinite level of nesting. How would I accomplish that? -- Craig...
2010 Dec 04
0
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
On Dec 3, 2010, at 8:03 PM, Thiago Farina wrote: > On Mon, Nov 29, 2010 at 5:02 AM, Anton Korobeynikov > <anton at korobeynikov.info> wrote: >>> I enjoyed the new coding style in recent patches. Camel case makes it easy >>> to pick a descriptive name. Starting functions and variables with lower >>> cases reduces chances to conflict with a type name. >>
2010 Dec 05
2
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
...te names for local variables. > Do you like the fact that local variables start with capital letter? Following the same convention used to name classes? It's a very strange adoption. I like the way that classes are named using CamelCase (MyClass, for example) and the instance of MyClass is my_class. That avoids many confusions in my brain. This convention used here: MyClass* MC = new MyClass, is an obstacle for external contributors used to work with C for example, where almost everything (and every project) uses the unix_hacker style.
2006 Jul 07
1
Style on _fields
How can I modify the style of a RoR field like text_field or password_field? I can use input in css, but how do I add a class? -- Posted via http://www.ruby-forum.com/.
2006 Mar 04
3
:class in link_to_remote?
Is there a way to set the class of a link in link_to_remote? I tried adding :class => "this_damn_class" after the :url hash and it didn''t work. I went ahead and did it manually using remote_function, i.e. <a class="this_damn_class" href="#" onclick="<%= remote_function ..., :url => {...} %>">My Link</a> -- Posted via
2007 Feb 23
2
[RoR],[C.L.R] How I convert a string object into a class?
People, Lately I''ve been using the .name() method of classes. For example: Person.name => "Person" Today... I''d like to do the inverse: "Person".to_class => Person How do I transform a string into a class? I''m working with a Rails app where I need to get names of AR classes at run-time. -Peter
2010 Dec 04
2
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
On Mon, Nov 29, 2010 at 5:02 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote: >> I enjoyed the new coding style in recent patches. Camel case makes it easy >> to pick a descriptive name. Starting functions and variables with lower >> cases reduces chances to conflict with a type name. > Honestly speaking, I don't. Especially in the cases when varname is
2007 Mar 13
5
worker starting twice
Hi gang, Thanks to other help I''ve gotten on this list, I''ve got backgroundrb up and running using postgres alongside my rails app. I''ve designed the system to have several eternally-running workers that periodically poll the database to see if there''s any work for them to do, and set things up in the config file to make them restart quickly if any of them
2017 Apr 28
2
RFC: Improving performance of HashString
According to... https://github.com/rurban/smhasher/blob/master/README.md Bernstein has quality problems (while xx is as good as you get in a non-crypto hash), and xx is 7x (32 bit) - 12x (64 bit) faster. That's on long strings. It would be worth checking the startup overhead for typically short identifiers in programs. See later on in the README: "When used in a hash table the