similar to: wondering how to do some clever DRYing up

Displaying 20 results from an estimated 600 matches similar to: "wondering how to do some clever DRYing up"

2006 May 24
2
named routes confusion
Hi, I''m trying generate a URL from a named route like: namedroute_url(params...) but the generated route is always coming out as the first match from the routes table. The named route is defined inside a map.with_options block, but that shouldn''t matter should it? dorian -- -- I do things for love or money
2006 Apr 28
2
tests and login_engine
Hi there, I just started writing tests today after some months of using rails (slap wrists). I seem to be getting the hang of things, but I''m hitting a wall when it comes to functional_testing pages protected by login_engine/user_engine. all my assertions come back with: Expected response to be a <:success>, but was <302> Is there a way I can login from within a test?
2006 Mar 29
1
load testing
hi, does anyone have any pointers for load testing an app running on apache2 with fastcgi? I have an app running circa 3000 page requests per day, most of which are static pre-cached files and fastcgi seems to be coping well so far (crosses fingers) but I would like to be able to work out my server limit. Currently I have the following in my apache conf: FastCgiServer
2006 May 09
1
name_url in tests
Hi there, I posted earlier asking about testing named routes in functional tests, but got no response, so I''m making my question less specific. It seems from the docs that it''s possible to to test named routes in cases such as: asserts_redirect_to name_url(:param => "whatever") but I haven''t seen any mention of it being used with any other tests and I keep
2006 Mar 24
10
innodb vs myisam
Hi, I have been using myisam tables in mysql with rails because my client will soon want fulltext searchable content, however when I migrated my development db from schema.rb all of the tables generated were innodb. I understand that I can override this, but also like the transactions and foreign keys of innodb. So 2 questions really: 1. are transactions in activerecord dependent on innodb or do
2006 Jan 23
2
require rmagick
Hello, I''m trying to use rmagick in a helper script (for auto-generating image sizes) and I''m not sure where I should be calling ''require''. currently I have: require ''RMagick'' at the top of my controller: class FilmsController < ApplicationController require ''RMagick'' but that''s giving me an error:
2006 Jun 07
1
railstidy
Hi there, anyone had any trouble with railstidy? I''m using it on 1.1.2 just to tidy my output and I get a server error everytime, but the only log message I get is: FastCGI: incomplete headers (0 bytes) received from server "/var/rails/dev/public/dispatch.fcgi" I have: after_filter :tidy def tidy RailsTidy.filter(response) end ...in my application.rb and I can get
2006 Jan 18
1
using unique varchar instead of id
Hi, I just signed up so ''hello everybody''. As the title suggests, I was wondering if there was an easy way to specify that I want all actions/controls to be based upon a particular parameter rather than :id (in this case :unique_name). I don''t :id to appear in URLs or elsewhere, I want it all to work from :unique_name. It seems like something that I should be able to
2006 May 09
2
handling file upload onto local filesystem.
Hi, I have a multipart form upload field uploaded through <%= file_field("profile", "profile") %> Once a submit happens, the action basically does something like: profile = Profile.new(params["picture"]) This invokes the models = to method: def picture=(picture_field) ...do a bunch of assignments here end def validate ... do a bunch of validations
2006 Mar 02
2
url_for_file_column not returning correct path
I added this test towards the end of the included file_column_helper_test.rb that shipped with the file_column plugin: def test_url_for_file_column_different_root_path Entry.file_column :image, :root_path => File.join(RAILS_ROOT, "public/files") e = Entry.new(:image => upload(f("skanthak.png"))) assert_match %r{/public/files/entry/image},
2006 May 16
4
dealing with media file formats and RMagick.
Hello, I basically have the following problem - I have a site that will allow people to upload videos. The video may be in any format - .mov, .avi, .wmv etc.. I can either use embedded Windows Media Player, or embedded Quicktime to play the files but the problem is, how do I create stills from the movies to display them as .jpg''s on my site so when somebody clicks on them, the video
2007 Oct 14
1
Story Runner: DRYing items used in many stories
The number of stories I have is growing and I''m writing the following step long hand in each story. Given ''a user named'', ''Andy'', ''Watts'' do |first_name, family_name| @email = first_name + ''@test.lan'' create_user( :first_name => first_name, :family_name => family_name, :email => @email )
2011 Apr 18
0
Drying my code ..
I am parsing an xml result using Hpricot, amazing .. I have a serie of tags to be transformed as parameters, so I am building Hash by looping on these tags , the resulting data is oK? but I ma not sure that I wrote a dry code ....... if doc.search(''response > error'').innerHTML.empty? accountTypes = [] (doc/:accounttype).each do |accountType|
2008 Jun 13
0
DRYing some controller code
def index if not @contest.nil? @videos = Video.paginate( :all, :include => { :ad => :contest }, :page => params[ :page ], :conditions => [ "videos.state = ''published'' AND contests.slug = ?", @contest.slug ] ) else @videos = Video.paginate( :all, :conditions => { :state => ''published'' }, :page
2007 May 30
0
DRYing up controller tests and mailer tests using superclasses
Hi! Currently both, the controller/functional tests and mailer tests, contain a lot of cruft. I''ve created two superclasses to DRY them up a bit. Here are some examples how tests using those superclasses will look: http://pastie.caboo.se/66139 Ticket with the patch: http://dev.rubyonrails.org/ticket/8521 Known issues: * Since we don''t explicitly setup the @request and
2010 Jul 04
2
DRYing Routes
I have a series of ''static'' pages for a site that need named routes in Rails 3. I''m trying to DRY the routes file, but can''t seem to find the proper code. The desired output/code is: match ''/about'' => ''info#about'', :as => :about for each page. My attempt to dry this: %w(about services articles marketing clients).each
2006 Aug 03
5
DRYing up the view
Hello everyone! I have generic views for CRUD operations For example I render(''shared/list'') from controller shared/list.rhtml ... <% for item in @list %> <tr class="<%= cycle ''list-line-odd'', ''list-line-even'' %>"> <%= render :partial => ''item'', :locals => { :item => item } %>
2008 Apr 24
3
DRYing up controllers
Hi I''m a big fan of plugins such as Resource Controller http://jamesgolick.com/2007/10/19/introducing-resource_controller-focus-on-what-makes-your-controller-special However, recently decided I don''t want to depend on a plugin for this, and would rather stick closer to the rails core. So does anyone have any cool strategies or ideas for achieving this? Or is there any move to
2006 Jan 23
2
scaffolding generators and pluralization rules
I''ve been working through the "Rolling with Ruby on Rails" tutorial and have come up against something I''m hoping someone here can help me understand. In part two of the tutorial, Curt introduces the "ruby script\generate scaffold re -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Apr 01
3
Gracefully degrading Ajax AND Drying up actions
Still a semi-newbie, but so far I''ve managed to solve most things with a bit of help from the Agile book, some googling around, and a bit of trial-and-error, but I''m really stuck with this one (very much an Ajax newbie): I know how to gracefully degrade an AJAX newpost type call so it can appear inline or (for those without JS support) go to a new page (put an ":href