Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
a

DONT THREAD ON ME fucked around with this message at 03:17 on Oct 8, 2014

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
a

DONT THREAD ON ME fucked around with this message at 03:17 on Oct 8, 2014

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Warning: This ended up being a really stupid problem.

Okay, I'm confused.

I have a 3 model hierarchy, Series -> Seasons -> Episodes.

code:

# == Schema Information
#
# Table name: series
#
#  id         :integer          not null, primary key
#  title      :string(255)
#  initials   :string(255)
#  created_at :datetime         not null
#  updated_at :datetime         not null
#

class Series < ActiveRecord::Base
  attr_accessible :initials, :title
  has_many :seasons, :dependent => :destroy
  has_many :episodes, :through => :seasons
  validates :initials, :title, :uniqueness => true
  validates :initials, :length => { maximum: 2, minimum: 2 }
  validates :title, :length => { minimum: 1, maximum: 50 }
end
# == Schema Information
#
# Table name: seasons
#
#  id            :integer          not null, primary key
#  series_id     :integer
#  season_number :integer
#  created_at    :datetime         not null
#  updated_at    :datetime         not null
#

class Season < ActiveRecord::Base
  attr_accessible :season_number
  belongs_to :series
  has_many :episodes, :dependent => :destroy

  validates :series_id, :presence => true
  validates :season_number, :uniqueness => { :scope => :series_id }, :length => { maximum: 2 }, numericality: true

end

# == Schema Information
#
# Table name: episodes
#
#  id             :integer          not null, primary key
#  season_id      :integer
#  title          :string(255)
#  created_at     :datetime         not null
#  updated_at     :datetime         not null
#  episode_number :integer
#

class Episode < ActiveRecord::Base
  attr_accessible :title, :episode_number
  belongs_to :season, :include => :series
  validates :title, :episode_number, :presence => true
  validates :title, :length => { :maximum => 150 }
  validates :episode_number, numericality: {only_integer: true}
  validates :episode_number, :uniqueness => {:scope => :season_id }

  default_scope order: 'episodes.episode_number ASC'
end
This has been working fine. I create Series with Series.create, Seasons with @series.seasons.create, and Episodes with @seasons.episodes.create.

I've spent the day messing around with my controllers and routes (I nested the route on these 3 models, just to get an idea of how it works). I'm struggling a bit with rerouting everything, but that's fine. What I'm really confused about is that now, I can no longer create new seasons. They tell me I need to define a series_id.

code:
1.9.3-p362 :001 > s = Series.create(title:"foo",initials:"FB")
1.9.3-p362 :007 > s.seasons.create!(season_number:1)
   (0.1ms)  begin transaction
  Season Exists (0.1ms)  SELECT 1 AS one FROM "seasons" WHERE ("seasons"."season_number" = 1 AND "seasons"."series_id" IS NULL) LIMIT 1
   (0.0ms)  rollback transaction
ActiveRecord::RecordInvalid: Validation failed: Series can't be blank

(I believe the Season Exists error is because the season_id is nil, not because the season_number exists).

Of course, I can't mass assigned the series_id, (and I don't want to). I've changed absolutely nothing on the models, aside from adding the default_scope order to Episodes. As I said, I've changed a lot with my controllers and routes, but none of that should apply to direct calls from within the console, right? What am I missing?

edit: I figured it out. I had a helper function in my Series model,

code:
def season
	Season.where("series_id = ?", id)
end
I left it out of my excepts above because I thought it wasn't actually doing anything. It was there from before I understood what I was doing. I was right: it wasn't doing anything. However, I'd inadvertently changed that code to:
code:
def seasons
Which, of course, conflicts with the implicit definitions of Series.seasons from the has_many declaration. Ooops.

DONT THREAD ON ME fucked around with this message at 04:23 on Jan 21, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Two somewhat related questions:

So the @ symbol means a var is scoped within a model/object, correct? So this means that using @ in a controller doesn't really do anything?

Second: It seems like the same scoping applies to helpers. How to helpers work exactly and what is the best practice with them? I realize you have to require them by your controllers in order to make use of them -- does that mean it's generally bad practice to use a helper within a controller?

I'm just really confused about what should be in a helper and what should be in a model. I've always read "skinny controllers, fat models," but in the tutorial I went through, the practice seemed to be "skinny controllers, skinny models, fat helpers."

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I'm trying to get chunked/resumed uploads working with the jquery uploader (https://github.com/blueimp/jQuery-File-Upload). I seem to remember reading somewhere that rails isn't really optimal for dealing with bitrange html headers (or something) and that I should use Apache for the file serving aspect. Is this true?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Alright, I"m launching my first production rails application on monday, I want to make sure I have my security ducks in a line, here:

w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/AFBKNY7VSH8,

I'm running Running rails 3.2.12, all of my models use attr_accessible
w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/RieVvnRGq8s

I"m running JSON 1.7.7

w/r/t the YAML thing, as I said, I'm using rails 3.2.12

Am I missing anything? Is there anything else I should be aware of?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Smol posted:

Here's a few security-related tools that are useful for every Rails' developer. We run brakeman on our CI, it's very easy to set it up with Jenkins. Also be sure to subsribe to the rubyonrails-security Google group.

http://brakemanscanner.org/

https://github.com/postmodern/bundler-audit

Bundler audit is nice. Thanks!

quote:

Have a backup strategy for when you get attacked by an rear end in a top hat and a page at /security with a PGP public key and an address for when you get attacked by a non-rear end in a top hat.
Is the purpose of the security page so that people can notify me of vulnerabilities? What's the purpose of including a PGP key?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
beep boop

https://groups.google.com/forum/?fromgroups#!topic/rubyonrails-security/4_QHo4BqnN8

https://groups.google.com/forum/?fromgroups#!topic/rubyonrails-security/KZwsQbYsOiI

https://groups.google.com/forum/?fromgroups#!topic/rubyonrails-security/zAAU7vGTPvI

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Probably because the post is an hour old and audit isn't aware of it yet

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Lexicon posted:

I should've read more before posting. Turns out a feature of it is that it doesn't require a network connection, and has its own dataset of vulnerabilities that gets updated periodically. So presumably you only ever get notified if you bundle update it, and then run it? Hmph.

wow, I also assumed it was querying a server somewhere. It would make sense that it takes at least an hour or two to get updates. That kinda sucks, but I don't think it's really intended as an up to the minute security watchdog; it's more more of a thing to use before an initial rollout/after major updates.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Lexicon posted:

Yeah :/ Fair enough - still a useful thing, but I guess it's not quite what I thought it was.

edit: I totally don't blame anyone for not wanting to run a server for free, but it's rather humorous in 2013 to call doesn't-rely-on-network a feature. You can get gently caress-all done without a network connection, including updating the drat vulnerability list.

Yeah it would just need to be an RSS feed setup somewhere with a vulnerability list.

Anyhow, it's not going to tell you anything that the google group doesn't, so your best bet is to just subscribe to that.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Cocoa Crispies posted:

It's not "ror" unless you're a recruiter, it's "Rails." Objects only usually have one file. Just because the scaffold generator makes files with similar names doesn't mean they have to be related.

Don't bother microoptimizing your workflow when you barely know what's going on; it'll save seconds but cost hours.

For me, it's definitely the largest minor annoyance in working with rails, and it's a totally legitimate thing to ask about. Rails' file structure, while logical, is pretty frustrating to navigate. Usually by the time I scroll through my views, I've forgotten what I'm looking for.

quote:

Just because the scaffold generator makes files with similar names doesn't mean they have to be related.

This is absurd.I didn't use the scaffold generator when I was starting out, but I still gave things similar names and put them in similar folders and obeyed the MVC, because it literally wouldn't work otherwise. Rails is built around the MVC and it places a huge emphasis on convention. If you give your controllers and models different names, you're going to make things hard on yourself. If you put files in the wrong folder, you're going to make it hard on yourself. Just because you can get around the convention, that doesn't you don't "get" ror unless you put everything in non standard locations. It's called Ruby on Rails for chrissake.

That said, I don't have an answer to the question. I tried creating a folder of symlinks outside my rails directory, and those folders grouped related models/controllers/views. But it was too much of a hassle to deal with.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Does anyone have any examples of really well written/designed gems (ruby or rails specific)? I'd like to put a really solid piece of code up on github as a work example, and I want to make sure I'm following solid design patterns.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Safe and Secure! posted:

Is there anything I can do, or any reason for me, to try prevent users from entering dangerous stuff as, say, usernames and email addresses in my Rails 4 app? I know there's a sanitize helper for the views, and I guess I could just run input through that before creating a model, but I'm interested in validations for this.

I guess the best I can do is write a custom validator with a regex that detects particular characters?

Yeah you should sanitize in your view and in your model. In your model you should be doing validations on any model before it's created.

http://ruby.railstutorial.org/chapters/modeling-users#sec-format_validation

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Safe and Secure! posted:

I need to style the markup of my Rails app's views. Can this just be as simple as looking at the bootstrap documentation and then making sure that all my HTML elements have classes from bootstrap, or is there anything I should keep in mind as go through it? I'm using the bootstrap-sass and sass-rails gems, if that changes anything.

It certainly can be that simple -- if you use bootstrap you dont have to ever touch a css file. Your views will look good but they will also look pretty generic as bootstrap is becoming fairly ubiquitous. The bootstrap website has a thing that will let you customize the style and then import it into your project, so you can try that. I didn't find it very useful.

If you need something more bespoke, you'll need to get into writing custom css files and using bootstrap mostly as a helper. But if you're starting out, I dont think there's any harm in just bootstrapping everything and then tweaking it from there.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
rspec and capybara will do the job if you're just getting started. Spork will greatly speed up test startup and run time.

If you use any Ajax/js, definitely consider disabling transactional fixtures and installing the database_cleaner gem. It will save you a lot of headache.

FactoryGirl is really really awesome, I like it so much I started using it in development.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I really need to give cucumber a shot. The regex thing really turns me off, (not because I cant write regexes), it just seems like such an odd way of going about things. And if you're not really consistent with your syntax I expect it's super confusing to write.

Is cucumber particularly well suited to anything, like view testing or integration testing?

DONT THREAD ON ME fucked around with this message at 20:05 on Aug 19, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Cocoa Crispies posted:

It's very very high level integration testing: I use it as a to-do list that checks itself off. I've heard that you should write scenarios in a way that you could use the same set of scenarios for HTML, iOS, and Android versions of an application.

code:
Given I am at the login screen
When I fill in my credentials
Then I should see the dashboard

Given I am at the reply screen
When I make a post
Then I should see my post in the thread

Okay that makes sense to me. This is kind of how I think of view testing (which I guess implicitly is integration testing), and I really hate doing it in Rspec/Capybara, so I'll give it a shot.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I messed with cucumber pretty hard last night and I take back all of the bad things I ever said.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Tru cucumber. I'm on day 3 of migrating all my integration tests from rspec to cucumber and it's awesome.

It sounds awful in theory but it's awesome in practice. Keeping bloat down feels really natural compared to rspec.

DONT THREAD ON ME fucked around with this message at 18:16 on Aug 22, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

prom candy posted:

Would you be willing to share a before/after of one of your tests? I'm thinking of adding Cucumber into a site that I've been managing for a few years. Our business-end client is exactly the kind of guy who can read and understand natural language features so I'm thinking it could be a good fit, but every time I sit down to write cucumber tests I feel like I'm wasting my time programming to a crazy DSL rather than just telling it what I want to test.

Yeah let me find some less embarrassing code. I'm pretty new to testing so my before/afters might not be a great example, but maybe you guys can give me some pointers.

Question: I had a bug in my application that was causing the DB to lock up when a form got double posted. I switched to postgres and fixed some issues, but I've never actually managed to replicate the bug. The post is submitted via JSON, and I've tried just sending multiple JSON posts but it wont happen. I've also tried manually clicking the button really fast but that doesn't do it either. Still though, users are managing to pull it off. Any tips?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Yeah I was using SQLite, and now I'm using postgres, so the problem is fixed. I just want to know how to test for the error, because I can't replicate it (on a server using an SQLite db).

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Wow ajax/javascript integration testing is extremely frustrating.

I pretty much only have one model with more than a trivial amount of ajax/javascript, and both selenium-chrome, selenium-firefox, and capybara-webkit all have different problems, unrelated problems that don't exist on a real browser.

It's not even async problems, I've got those mostly worked out. It's things like the browser trying to click on buttons off screen (and failing), or z-index issues making buttons unclickable.

DONT THREAD ON ME fucked around with this message at 05:57 on Sep 9, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
This is how I deal with problems like that. It's not very "rails" but my code got way, way cleaner when I stopped using callbacks that do anything more than change the internal state of the model. I've never used :accepts_nested_attributes though so I don't know much about it.

http://samuelmullen.com/2013/05/the-problem-with-rails-callbacks/

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Cocoa Crispies posted:

Is the JS modular and DOM-independent enough that you can use something like jasmine to unit test it?

Unfortunately no. Most of my JS comes from gems or is so simple that it doesn't really need to be tested, I'm really only testing the JS elements implicitly. It's just that (one of my more important) views has a lot of ajax going on and I can't test it unless I'm in a JS capable webdriver.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
rails tutorial is good and will teach you a lot of other useful skills (git, if you dont know it already) and probably taught half the people in this thread

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Buckhead posted:

I am new-ish to Rails and web development in general and just managed to move my Rails app with PostgreSQL from Heroku to Digital Cloud using Dokku (which is basically meant to emulate Heroku). It was pretty challenging but all is working now. The one remaining thing I want to accomplish is to connect to my app's PostgreSQL server using pg Admin III on Windows. I have found some instructions that require a Linux tunnel but I don't think that would apply to me. Does anyone have any advice on how to do this?

Shouldn't you just be able to open up the pg port on your server and connect to it that way (probably a really bad idea for security reasons)?

Anyhow, you should be able to open an SSH tunnel on windows but I've never done it. Try using PuTTY. Here's their instructions for port forwarding:

http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter3.html#using-port-forwarding

What does windows do instead of SSH? I can't imagine functioning without it.

DONT THREAD ON ME fucked around with this message at 23:30 on Feb 10, 2014

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

The Milkman posted:

I'm working on a thing where an admin can upload a series of images, and the front end will display one, then after X amount of time start displaying the next one. Alternatively it could complete a cycle every X (6-12ish) hours. It's not super strict in that regard. It's not a live loading JS thing, just on page load you'll get an image from the server.

My first thought would be whenever/cron but perhaps there's a better way? Perhaps slicing up a chunk of time by the count of images and comparing it against the current time? I'd appreciate input from anyone who's tackled something like this before.

I'm not really understanding your question. Why can't you just use timeout? If you're not doing liveloading, you can just have an array of image URLs and every x minutes it pops a url off the array and displays it.

Your method of comparing time would work but it would be needlessly complicated unless it would achieve some purpose that I'm not understanding.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
The problem with what you're trying to do is that in order for your module to call the superclass method :edit, your module method needs to be named :edit. If you do that, it will work fine. But the problem then is that you have a module method :edit, and a class method :edit, and they will conflict.

Instead of calling calling the super method edit, can you rename the superclass method to something else and call it directly? or alias it?

DONT THREAD ON ME fucked around with this message at 22:51 on Feb 14, 2014

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
You could also do something like this:

code:

module MyModule
  def edit_helper
	self.class.superclass.class_eval do 
		alias_method :edit_helper, :edit
	end
	super do |success|
      	success.js { render "my/partial", :locals => { :my_local => some_val } }
        end
     end
  end
end

    
#some controller

  def edit    
    ....
    edit_helper 
     ...
  end  

There's probably a better way to do this.

DONT THREAD ON ME fucked around with this message at 23:37 on Feb 14, 2014

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Smol posted:

That's a pretty terrible way to do it, especially performance-wise (MRI, for example, will invalidate all inline method caches when you alias an method). I'll post my thoughts tomorrow

Yeah I definitely wouldn't do it. I feel like the approach is bad in general, but I don't really have any counter suggestions.

DONT THREAD ON ME fucked around with this message at 08:37 on Feb 15, 2014

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
An integer?

Does the attribute really need to be persisted? i.e. can the state be derived from other attributes on the model?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Or switch to MongoDB

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Using null to mean something other than null would probably have a lot of unintended consequences. Plus you wouldn't be able to tell whether the field was truly null or 'maybe.' Just use 1,0,-1. Integers are cheap, and the only part of your domain that needs to have any idea that your db is storing integers and not something meaningful like true/false/maybe are the methods you use to store and access the data. Once you've pulled it from the DB, you can give it a meaningful representation.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
woops

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I've been applying for ruby on rails jobs a lot lately, and the big thing that seems to be holding me back is that I don't have any experience dealing with applications "at scale." I'm running a "mission critical" rails app at my job, but it's mostly an internal app and it doesn't see a ton of traffic.

The "do you have experience scaling rails apps" question keeps coming up on interviews, and I don't have a good answer for it. Our app is deployed on aws and I have experience with that side of things, but I haven't dealt with load balancing and I coulnd't sync databases between CDNs.

How can I go about building some skill/knowledge in these areas without actually running a high traffic web application? Or should I not worry too much about this stuff if I'm just seeking a job as a junior developer?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Pollyanna posted:

Okay, so two out of two interviews so far have touched on whether I was familiar with Rails. I am not, and I haven't done anything with Ruby past the tryruby tutorial months back, so I'm going to go ahead and just learn it already. Is the Rails tutorial a good place to start, or should I start with something more about Ruby in general?

Yeah it's the place to start. You don't need to start with Ruby. I'd start with Rails and then jump more deeply into Ruby later. But he even includes a more in depth look at ruby in section 3 or 4 or something. Alternatively you could just run through the codeacademy thing on ruby, that will get you up to speed in a few hours.

Also don't listen to those guys who told you not to bother with the testing stuff -- they might not care about it but almost everyone else will.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

kayakyakr posted:

This is actually good advice. develop a good testing habit so that you don't develop a bad no-testing habit like I did. It's hard to break.


You could caveat with not having had the fortune to have a high traffic web app yet, and then throw out a bunch of the usual suspects as things you would look into in order to scale upward:
- Code refactoring
- Smart Caching
- Vertical Scaling using a multi-threaded or multi-process servers on more powerful hardware
- Horizontal Scaling behind a load balancer
- Database scaling if that is the bottleneck

And on and on. Code refactoring is the most important part of that. You may be surprised at how much of an improvement you can get from identifying slow points and simply writing better, more efficient code.

But really, I don't know why they would be looking for experience with app scaling in a jr dev position unless they were trying to fix a problem they have without actually spending the money to hire someone who knows how to fix it by stealing away a jr dev who has seen it done. I wouldn't worry about it too much.

Thanks, I'll at least learn how to talk about this stuff. I guess I'm frustrated because I've gotten the 'I guess we were looking for someone a bit more senior' line a few times now and really the only Rails thing I'm definitely inexperienced with is operating at scale. (But it could just be that I've said dumb things during interviews. Or that I'm applying at places that don't know what they want).

I've asked a bit in the jobs thread, but I'll ask here: Aside from applying to everything on linked in, any leads for tracking down junior level rails positions? I've got about 2 years under my belt but like I said, it wasn't at any kind of scale. I feel like I should be a shoe-in for a jr position but I havent had a lot of luck yet.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Hello friends,

I work on a very large, old (for rails) codebase. My team has inherited a large section of code and none of us really understand it. Anyhow, I'm trying to write some tests using the existing factories, and they're a mess. I don't want to use them, but they need to remain in place because we have tons and tons of other tests currently relying on them. What is the best way to work around the existing factories without removing them?

My options:

1) Settle for doing something like FactoryGirl.define(:class_new, class: class) with all my new factories
2) Refactor all the old factories/tests to use FactoryGirl.define(:class_old, class: class)

Or something like:
code:
before my_tests
    FactoryGirl.class_eval do 
        @factories.keys.match(/model_regex/).each{|k| @factories.delete(k)}
        define_new_factories
   end
end
after my_tests
    FactoryGirl.class_eval do 
        @factories.keys.match(/model_regex/).each{|k| @factories.delete(k)}
        define_old_factories
   end
end
(that's the wrong attribute accessor but I tried this and it works. But I have no idea what the side effects of this are. I'm sure there's probably a cleaner much cleaner way to remove factories but I havent looked into it because it seems like a bad idea).

4) Use FactoryGirl.modify to modify the classes as needed. I think this would just create more confusion.
5) Just live with what's there.
6) Don't use factory girl.
Which of these is the least idiotic? I'm leaning towards number 2.

DONT THREAD ON ME fucked around with this message at 00:31 on Jul 31, 2014

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

kayakyakr posted:

e: option #7 and the one that will probably cause you the least heart-ache long run is refactor the factories through the complete code base. In other words, fix the factories and then fix broken tests.

Yeah, that's the very long term goal. Ideally someday we'll move the tests over to using the new factories but who knows if that will ever happen. At least new tests will have maintainable factories to use.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply