search for: dryer

Displaying 20 results from an estimated 26 matches for "dryer".

2012 Apr 03
4
one master table to hold symbols: good or bad idea?
...l < ActiveRecord::Base validates :name, :presence => true def self.intern(name) (r = where(:name => name.to_s)).create! rescue ActiveRecord::RecordNotUnique r.first end end ... and using this wherever I''d previously used separate classes. This feels DRYer. Can anyone give a strong argument for or against this approach? -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3Mb...
2007 Mar 28
5
link_to best practice
...> ''New education record'', :title => ''New education record'' }), new_education_path(@consultant) %>&nbsp;<%= link_to ''New education record'', new_education_path(@consultant) %> ... but it feels really really unDRY! Anyone got a DRYer solution please? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3M...
2008 Dec 12
1
mixed model nested ANOVA
...ocations (about 20 to 30 trees/location, NOT balanced), grouped in 3 different climatic zones (Sahelian, Soudanian and Guinean) (NOT balanced). Further, each tree is characterised by some degree of human pressure (mutilation degree), in total 4 different degrees were defined (NOT balanced). In the dryer zones, the trees are under a much higher human pressure than in the more humid climatic zones, "zone" and "mutilation degree" are thus strongly correlated. I want to know how "zones" (fixed effects, climate interests me) and "locations" (nested in "zone...
2006 Jul 22
3
refactoring commonly used aggregations
...e in lib/clwholename.rb and requiring it in my model but the section of "composed of :clwholename" simply doesn''t work if I put it into helpers (I assume because that is for views and not controllers) or in the lib/clwholename (unknown method composed_of) and I am not getting any DRYer. What''s the best way to handle this? Craig
2006 Sep 03
8
first request always fails
Hi, Whenever I restart mongrel on my production server, the first request in my browser always fails, I get this error: Processing Base#index (for 83.xx.xx.xx at 2006-09-03 16:08:47) [GET] Session ID: f1918346d193e19a70c3230286e5ce1a Parameters: {} TypeError (superclass mismatch for class Stats): /app/models/stats.rb:1 stats.rb:1 just contains a normal A/R line: class Stats <
2006 Apr 28
4
Conditional in Model
Hello ~ Is there a way to determine within a model which controller/action instantiated the model? Thx, -- Ben Reubenstein http://www.benr75.com
2011 Jul 15
3
Ruby variable that embeds html tags
...d </span> sitting at the end of every required line. I''d like instead to use a variable: <% req = "<span class=''required_field''>Required field</span>" %> And then have <%= f.text_field :screen_name %> <%= req %> Shorter and DRYer. But when I do that, I get my HTML printed to the screen, not interpreted. Help appreciated. Thanks! Jacob -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3Mboc...
2007 Apr 11
10
DRYer controller specs
So, I''ve been following the recommendations for controller specs here: http://blog.davidchelimsky.net/articles/2006/11/09/tutorial-rspec-stubs-and-mocks Most notably: a single expectation per specify block; the setup block contains only stubs; mock expectations each get their own specify block. (I''m still using 0.8, so I haven''t gotten the describe/it goodness yet.) I
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate
2006 Aug 15
6
Theoretical: Should models be subclasses of AR or mix it in?
All, My apologies if this is a little long-winded and stream of consciousness-y :). SUMMARY: Why do we extend ActiveRecord instead of mixing it in to our model classes? Been thinking about my app''s models and starting to want to build something of a hierarchy. I have some commonality across 3 of my model classes and I''d liek to aggregate the behavior in a superclass.
2006 Aug 16
1
Several Problems with Umlauts
...utf-8 already ?? - The Submit Tag Helper does not handle Umlauts. I have to convert the button text to utf-8 with IConv. Hmm ... My workaround is to use IConv to convert all those strings to utf-8 or - in the case of ActionMailer - to ISO-8859. It works but is really ugly. Any help to a "dryer" solution is very welcome ! Gernot -- Posted via http://www.ruby-forum.com/.
2005 Oct 13
0
Re: rubyonrails problem w/ multiple dbs and webrick
..., and then overriding the table names to include the DB name ("rails"), e.g.: class User < ActiveRecord::Base set_table_name "rails.users" has_and_belongs_to_many :roles, :join_table => "rails.roles_users" ... There''s also probably a DRYer way of doing this (suggestions welcome!), and it may very well be MySQL-specific. but it works for me (YMMV). [0] http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000738 ============================================================================== Steve Sloan...
2007 Jun 22
1
nested rest URL => passing param from select
Hi, I''m trying to create a select box with an onchange event. When onchange is fired, I want to redirect to a nested rest url. The problem is that I don''t know how to pass the selected value to the url: <select id="category" onchange=" <%= remote_function(:url => category_articles_path(selected value?) ) %> "> Any suggestions? -- Posted
2006 Oct 20
2
Dataset on Baltimore home energy costs
...st of electricity (including delivery and commodity charges) temp: average daily outdoor temperature in degrees Fahrenheit, as printed on the bill days: number of days in billing period. Heating system is a 10-15 year old natural gas steam boiler supplying iron radiators. Hot water heater, clothes dryer and stove and oven are also natural gas. Air conditioning is by various numbers of window units. If surface area of house is desired, I can add this at a later time. Some interesting points in time: 22-Apr-04: Date when I upgraded 2 failed, older storm windows to more modern ones. 1-Sep-04: Date...
2004 Aug 06
0
Live from Mongolia
...physically near the servers in case something didn't work. After a couple of successful live events, this turned out to not be an issue. The only problem to date has been the fact that our circa 1950s home electrical system only sports a 30 amp main fuse which means turning on the washer, dryer, and dishwasher at the same time causes us to lose power (and thus the whole network of servers, networking gear, and connected listeners). This generally isn't an issue and besides, I'm too cheap to install UPS equipment. But this all came to a head last winter when during one live b...
2011 Jan 14
6
Server reboots unexpectebly.
Dear group, I am in the process of configuring 2 new servers. They are running Centos 5.5 and for the last three days they have been rebooting unexpectedly, can you point me in the right direction what to look for in the logs. I have been checking /var/log/messages but don't see anything that hint me any clues why this is happening. Your input is much much appreciated. Lisandro PS. These are
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert
2006 May 16
4
Problems with multiple ''id'' columns in a join_table
I have a problem declaring a relationship through a join_table ; the SQL generated by ActiveRecord is correct, but there are two columns called ''id'', and the final object gets the ''wrong'' column ... Here''s a more detailed description of the data, code, and problem :- There''s a People table, with id, name, and a few things. Also a
2009 Feb 22
6
CHECK if param exists? please help
hi folks. i want to check if a param exists if not to set it to a default value for my date range filter. in my controller i have: @from_date = Date.strptime(params[:startdate],"%d/%m/%Y") @to_date = Date.strptime(params[:enddate],"%d/%m/%Y") @articles = @results.find(:all, :conditions => [ "created_at >= ? and created_at
2011 May 24
6
OT: wifi, phone, power in India and Malaysia
A not so technical friend in India is shopping for a laptop. He often travels and stays months in Malaysia and so needs to be able to use the laptop there as well. He typically connects to the internet via wifi, but sometimes must use a telephone line (yes, with a modem). And of course there will be times when he has to plug into mains power to recharge the battery. So to be able to fully use