Search Amazon.com:
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 $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
«141 »
  • Post
  • Reply
HIERARCHY OF WEEDZ
Aug 1, 2005



I'm trying out Aptana+RadRails for a project, and I'm curious. autotest works fine when saving the actual models/views/controllers, but won't activate if I save a test file. Is there any way to get autotest to run a file in /test/ when it gets saved?

Adbot
ADBOT LOVES YOU

HIERARCHY OF WEEDZ
Aug 1, 2005



And another question - how the hell do you deploy to a subdomain?

I've tried installing Typo to blog.mysite.com. So I'd have something like ~/sites/blog.mysite.com/public symlinked to ~/public_html/blog and a subdomain created which points to that directory. First I had to figure out the trailing slash problem (the difference between mysite.com/blog/ and mysite.com/blog) but now that that's working, going to blog.mysite.com doesn't work at all. There's got to be a way to fix this without resorting to site-specific routing stuff, right?

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

Chiming in to say that I'm quite experienced with Ruby and Rails after working with it full time for the last year, so I'll gladly answer any questions anyone might have.

My project is a web-based role playing game based on Internet culture. It's got over 100 models and uses a lot of awesome Ruby meta-programming tricks. It uses Haml for the templates and Sass for the stylesheets.

shopvac4christ posted:

I've tried installing Typo to blog.mysite.com. So I'd have something like ~/sites/blog.mysite.com/public symlinked to ~/public_html/blog and a subdomain created which points to that directory. First I had to figure out the trailing slash problem (the difference between mysite.com/blog/ and mysite.com/blog) but now that that's working, going to blog.mysite.com doesn't work at all. There's got to be a way to fix this without resorting to site-specific routing stuff, right?

What web server are you using? Because deployment changes drastically depending on this. For example, in Apache2 I'd set up a NamedVirtualHost to whatever directory you're running your Typo install out of (forget the symlink).

HIERARCHY OF WEEDZ
Aug 1, 2005



Grob posted:

Chiming in to say that I'm quite experienced with Ruby and Rails after working with it full time for the last year, so I'll gladly answer any questions anyone might have.

My project is a web-based role playing game based on Internet culture. It's got over 100 models and uses a lot of awesome Ruby meta-programming tricks. It uses Haml for the templates and Sass for the stylesheets.


What web server are you using? Because deployment changes drastically depending on this. For example, in Apache2 I'd set up a NamedVirtualHost to whatever directory you're running your Typo install out of (forget the symlink).

My host (Site5) is using Apache, but I'm not sure how much control I have over it.
EDIT: Yeah, I can only edit .htaccesses.

HIERARCHY OF WEEDZ fucked around with this message at Sep 5, 2007 around 15:22

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

shopvac4christ posted:

My host (Site5) is using Apache, but I'm not sure how much control I have over it.

Unfortunately controlling what subdomains point to where is really a web server configuration issue, nothing specific to rails. If you can't touch Apache's configuration files, it will probably involve some hackery outside of rails to get it to work.

HIERARCHY OF WEEDZ
Aug 1, 2005



How would one deploy a common library to all sites on a server? I ask the question this way because I'm coming from ASP.NET, where if we updated something in a global utilities library, we could just copy the DLL to separate projects, or even better, import it server-wide. I'm guessing it has something to do with plugins and maybe using capistrano to update the plugins for each site in a special deployment, but beyond that I wouldn't have any ideas.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

shopvac4christ posted:

How would one deploy a common library to all sites on a server? I ask the question this way because I'm coming from ASP.NET, where if we updated something in a global utilities library, we could just copy the DLL to separate projects, or even better, import it server-wide. I'm guessing it has something to do with plugins and maybe using capistrano to update the plugins for each site in a special deployment, but beyond that I wouldn't have any ideas.

Either the same plugin copied to each site, or if possible build a gem and install that on the system for all the apps to use.

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

shopvac4christ posted:

How would one deploy a common library to all sites on a server? I ask the question this way because I'm coming from ASP.NET, where if we updated something in a global utilities library, we could just copy the DLL to separate projects, or even better, import it server-wide. I'm guessing it has something to do with plugins and maybe using capistrano to update the plugins for each site in a special deployment, but beyond that I wouldn't have any ideas.

One of the great features of Subversion (which I assume you're using because you mentioned capistrano) is the ability to have externals. An external is the ability to point part of your source tree at another source tree altogether.

What I would do in this case is build a new tree for your plugin, then put it as an external in the plugins directory of each project. Then, whenever you do a svn update (through capistrano or local, whatever) you'll get the latest stable version of your plugin.

I'm on edge rails right now, and I have my vendor/rails directory set up as a svn external. Every time I do a svn update, it grabs the latest version of rails for me, which is awesome. I also do it for Haml.

Fork
Aug 4, 2004


Grob posted:

One of the great features of Subversion (which I assume you're using because you mentioned capistrano) is the ability to have externals. An external is the ability to point part of your source tree at another source tree altogether.

What I would do in this case is build a new tree for your plugin, then put it as an external in the plugins directory of each project. Then, whenever you do a svn update (through capistrano or local, whatever) you'll get the latest stable version of your plugin.

SVN externals can sometimes be a royal pain in the rear end. An excellent alternative is Piston (http://piston.rubyforge.org/). You can even use this to maintain your own specific changes to a plugin while also maintaining updates upstream.

CHRISTS FOR SALE
Jan 14, 2005

"fuck you and die"


Is there an easy, lightweight, but most of all SECURE plugin or library to use for user authentication? I'm trying to integrate restful_authentication as the user/sessions manager for my app but it just keeps giving me problem after problem, and honestly I'm not too familiar with the way Rails works yet so I really don't know how to fix an error that's caused by the README telling me to put a line of code in a file.

This is the only qualm I have about Rails. Kids, if you're trying to learn Rails be prepared for shitloads of blackbox code. If you download a plugin and it doesn't work, and you aren't very fluent with Ruby/Rails conventions yet, tough poo poo. I'd love to use restful but every time I fix a problem it creates new ones.

Space Kimchi
Jan 7, 2007

by Peatpot


brb buddy posted:

restful_authentication

OK I am really starting to wonder what the hell.

I decided to look up how this REST crap goes with logging in, since session cookies are EVIL. I came up with:

http://www.berenddeboer.net/rest/authentication.html

what. the. hell. It's pages long and , and I don't get what all that effort really gets you. Less flexibility and more regular expressions, hey my two favorite things in the whole wide world!

Seriously it's like Ruby on Rails made web development too easy so someone dragged out a quote by Tim Berners-Lee or whomever the hell from 1996 and made a "what if" game to play while coding RoR applications. "What if all the cool new features of modern browsers to make up for the lovely statelessness of the original HTTP1.0 were REMOVED and we COULDN'T USE THEM?" Because developing web applications just isn't a huge enough timesink, I guess we need to triple our effort and put arbitrary limitations on which standard web browser features we can use. Awesome. Also, no verbs.

If someone wants to waste their time on this crap, knock yourself out, I guess. I'll be over here making stuff that works and just worrying about the normal lovely timesinks involved in web dev, like cross-browser CSS compliance and having the w3c inspector not poo poo bricks when I send my site through it to please some dude in IRC who swears my problems with something unrelated has to do with not using & for link strings with an ampersand in them.

Space Kimchi fucked around with this message at Sep 8, 2007 around 21:39

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

Space Kimchi posted:

If someone wants to waste their time on this crap, knock yourself out, I guess. I'll be over here making stuff that works and just worrying about the normal lovely timesinks involved in web dev, like cross-browser CSS compliance and having the w3c inspector not poo poo bricks when I send my site through it to please some dude in IRC who swears my problems with something unrelated has to do with not using & for link strings with an ampersand in them.

It's interesting, because most web developers I know just "get" the basics of rails (activerecord, controllers, views, rjs) when they first see it. The way it's organized and does the database handling is pretty intuitive.

I can't say the same for the REST stuff. It's often a head scratcher -- like why would I bother to do all that extra work when the end product is the same?

There is an advantage though, it's about organization. One of the best things about a rails app is if you need to debug it, you know exactly what file to go to in what directory, since they're all organized the same way.

The REST stuff takes it a little further, in that it names the majority of your controllers and their methods for you. You always call the same methods to insert, update, delete, etc. Additionally, you get a lot of cool "black magic" for finding the paths of things.

Al Azif
Nov 1, 2006


Space Kimchi posted:

"What if all the cool new features of modern browsers to make up for the lovely statelessness of the original HTTP1.0 were REMOVED and we COULDN'T USE THEM?" Because developing web applications just isn't a huge enough timesink, I guess we need to triple our effort and put arbitrary limitations on which standard web browser features we can use. Awesome. Also, no verbs.

Statelessness isn't pointless. The most obvious benefit of REST is that it helps sites scale; you can farm out a site to many servers without having to worry about them sharing session data, and it makes your site more cacheable.

HTTP is stateless by design, not because they couldn't have come up with something better.

Also, RESTful authentication would be easy (even easier than session-based) if browsers would just get their acts together and put a decent interface on HTTP authentication.

CHRISTS FOR SALE
Jan 14, 2005

"fuck you and die"


I really don't care about using REST, as I don't even really know (or care to know at this point) what it is. I just want a simple way to authenticate multiple users, and restful_authentication does this with a method (logged_in? I believe it is). So basically I call that method and that's my security check. It's also got e-mail account activation, and it's scalable. I want a plugin to do that, if not I'll have to waste a lot of time learning how Rails handles cookies and sessions, and while that seems like an interesting future project I'd prefer if the user system would just work now.

And Railscasts sucks, making it seem like it's easy as pie to get this plugin to work...It's not, the plugin doesn't loving work as intended.

Hammertime
May 21, 2003
stop

I'm using RoR to commercialize web app version of a traditional rich client app.

I've been learning as I go. It's been all roses except for a few times where convention/language immaturity has hosed me. I'd sure love some more thorough documentation, that's for sure.



One obscure but confusing pitfall:
Rake is just a ruby gem. Due to this, it also seems to suffer from documented problems if you use various "reserved words" (not mentioned anywhere, just stuff that crosses over with a few rake methods). I didn't think this would be the case due to the separate namespaces but it seems I'm wrong.

I was creating some randomly generated sample data in a rake migration file for performance testing, and I spent an hour trying to work out what I was loving up. Turns out having validates_presence_of :task creates a conflict, due to the use of task in Rake.

I don't fully understand how this conflict occurs, but apparently there are a handful of other words/symbols that can't be used when raking.

ImDifferent
Sep 20, 2001


Space Kimchi posted:

HTTP rant

Amen, brother.

HTTP has to be the worst thing to happen to application development in a long, long time. Don't get me wrong - as a protocol for retrieving documents, and nothing else, it's ok, I guess.

As a general-purpose protocol which acts as the foundation for all our future application development? Oh. My. God.

After all the crap that was added to correct some of its deficiencies in this regard, all we have is a whole bunch of ill-defined standards, and programmers having to code around the various bugs in IE's implementation of them.

Sometimes I wish we could just take a step back, and come up with something better. Fat chance.

Space Kimchi
Jan 7, 2007

by Peatpot


Some good replies here about REST, and I'm glad there's nobody being an insane zealot about it and having a rational discussion. Times like this it makes the $10 (times how ever many times I've been banned and bought/rebought features ) so worth it

And yeah the statelessness of HTTP is why it became popular in a way. It's just less resources and easy to set up, but I think in applications. You just can't have an application without states, it's impossible. REST is great for like blogs and wikis and stuff but I'm interested in interactive web applocations, and awesome uses of AJAX. Some things just have to be verbed, and some things just have to have states.

When I have time to blow on doing more RoR I'm basically trying to make a multi-user game that is played over a web interface. There are enough challenges without worrying about REST. I see the value in developing large apps but ugh, still. HTTP authentication makes your site look like it's a piece of poo poo from 1994.

If they find ways to make REST a natural-feeling part of Rails I won't complain, but only if it does't make me have to hack stuff to get it to work. In the meantime, I like my verbs and session cookies.

Al Azif
Nov 1, 2006


Space Kimchi posted:

Some good replies here about REST, and I'm glad there's nobody being an insane zealot about it and having a rational discussion. Times like this it makes the $10 (times how ever many times I've been banned and bought/rebought features ) so worth it

Hey, I wish there was a well-deployed stateful protocol too; then you could do things your way and I'd do them my way and it would become pretty obvious what architecture's better for what kind of problem, and application designers could focus on their applications instead of hacking around protocol design decisions, and protocol designers could focus on solving specific problems instead of defending their design decisions.

quote:

And yeah the statelessness of HTTP is why it became popular in a way. It's just less resources and easy to set up, but I think in applications. You just can't have an application without states, it's impossible.

The trick is to keep the state on the client side; AJAX actually makes this very easy.

quote:

HTTP authentication makes your site look like it's a piece of poo poo from 1994.

It's a damned shame; blame the browsers.

Have you taken a look at continuation-based web frameworks like Seaside at all? Seems like it would be right up your alley.

Space Kimchi
Jan 7, 2007

by Peatpot


Al Azif posted:

The trick is to keep the state on the client side; AJAX actually makes this very easy.

Have you taken a look at continuation-based web frameworks like Seaside at all? Seems like it would be right up your alley.

Yeah well, you know what they say about clients and how much you can trust them. I've never really had issues with cookie authentication because it's relatively hack-proof. Aside from people somehow getting other people's session cookies (if they can there are usually much more serious problems to work with, and you can do things like tying them to IP addresses if you REALLY need something secure) you can't tamper with individual data items. If you're doing some kind of online game, this is ideal. You want the game to handle any logic or transactional things, NOT the client. See: any Korean MMORPG ever made.

What I have in mind for my project is something like at http://vse.marketwatch.com though with some important differences. The details are secret for now, as I am no John Romero and I'm not sure if this thing is ever even going to get made yet, but needless to say there will be lots of privately generated pages that aren't public, and will update frequently, and just won't work well in a REST situation. You don't WANT to be able to copy and paste URLs from some parts and expect things to work.

I'll look at REST when I want to create Wordpress on Rails or whatever because we don't have enough blogging platforms, but for a game?

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

brb buddy posted:

I really don't care about using REST, as I don't even really know (or care to know at this point) what it is. I just want a simple way to authenticate multiple users, and restful_authentication does this with a method (logged_in? I believe it is). So basically I call that method and that's my security check. It's also got e-mail account activation, and it's scalable. I want a plugin to do that, if not I'll have to waste a lot of time learning how Rails handles cookies and sessions, and while that seems like an interesting future project I'd prefer if the user system would just work now.
What version of rails are you using? Recent versions of restful_authentication have been geared towards working with Edge Rails/Rails 2.0 and not the current stable version, so that might be why you're having so much trouble. I don't know, I haven't used newer versions of restful_authentication.

brb buddy posted:

And Railscasts sucks, making it seem like it's easy as pie to get this plugin to work...It's not, the plugin doesn't loving work as intended.
See above, Rails moves so fast that what worked perfectly 6 months ago may be deprecated and abandoned today.

roop
May 10, 2002

I am become Roberto, the destroyer of scoring chances


I need to create a very simple web app:

- A "Team" which contains main contact information
- A "Participant" which contains a particular person

The Team has_many participants and the participant belongs_to Team

It's a simple one-to-many relationship

All I really need the app to do is add those together as one step. i.e. Create a team and add the participants.

So far what's stopping me is how to implement the one-to-many in Rails.

Does anyone have a sample application that implements a one-to-many and has views that allow them to be created at once? Should I be combining the two above into one Model? Or should they be two separate models with a single controller?

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

roop posted:

Does anyone have a sample application that implements a one-to-many and has views that allow them to be created at once? Should I be combining the two above into one Model? Or should they be two separate models with a single controller?
Keep the two models, use one controller. Here's a tutorial that explains how to do what you're asking.

skidooer
Aug 5, 2001


roop posted:

Should I be combining the two above into one Model?
Kind of.

code:
class Team < ActiveRecord::Base
  has_many :participants
  attr_accessor :participant
  after_create :create_participants

  protected
    def create_participants
      participants.create(participant)
    end
end
code:
class TeamController < ApplicationController
  def create
    @team = Team.create(params[:team])
  end
end
code:
<% form_for :team, :url => teams_path do |f| %>
  <%= f.text_field :name %>
  <% f.fields_for :participant, Participant.new do |p| %>
    <%= p.text_field :name %>
  <% end %>
<% end %>
You'll probably want to write a much more robust model than that, but that's the basics. Note that the FormBuilder::fields_for method doesn't exist in 1.2, so you'll have to either add it yourself or move to edge.

skidooer fucked around with this message at Sep 11, 2007 around 14:16

roop
May 10, 2002

I am become Roberto, the destroyer of scoring chances


Thanks, after quite a bit of trial and error I've got it functional.

Now to make it usable with the magic of error handling and stylesheets

HIERARCHY OF WEEDZ
Aug 1, 2005



Ambition is getting more awesome:

quote:

Ambition has gone from generating generic SQL to respecting your database of choice (as long as itís MySQL or PostgreSQL). [...] And because Postgres supports case insensitive regular expressions, so do we:

code:
User.select { |m| m.name =~ /chris/i }
SELECT * FROM users WHERE users."name" ~* 'chris'

And some vague benchmarks:

code:
# Ambition 0.1.0
                           user     system      total        real
simple select          7.030000   0.020000   7.050000 (  7.052899)
dual select            8.050000   0.010000   8.060000 (  8.094917)
join select            7.890000   0.030000   7.920000 (  8.003906)
dual select w/ sort   13.390000   0.040000  13.430000 ( 13.529581)
dual select w/ stuff  13.600000   0.050000  13.650000 ( 14.107565)
it's complicated      16.030000   0.070000  16.100000 ( 16.213238)

# Ambition 0.2.2
                          user     system      total        real
simple select         0.910000   0.010000   0.920000 (  0.921048)
dual select           1.380000   0.010000   1.390000 (  1.398235)
join select           1.950000   0.020000   1.970000 (  1.981603)
dual select w/ sort   1.960000   0.000000   1.960000 (  1.964018)
dual select w/ stuff  2.080000   0.010000   2.090000 (  2.111435)
it's complicated      2.820000   0.000000   2.820000 (  2.831330)

MrSaturn
Sep 8, 2004

Go ahead, laugh. They all laugh at first...

This is a question so stupid, I can't believe I'm asking it, but:

how do I link to a static page within my domain? I want to make a contact page for my application, but there's no dynamic content to be put on it. I tried making app/views/contact/index.rhtml, and I got a routing error when I pointed my browser there.

where do I put a page to link to, say
localhost:3000/contact?

atastypie
Dec 2, 2000



it goes in /public

MrSaturn
Sep 8, 2004

Go ahead, laugh. They all laugh at first...

atastypie posted:

it goes in /public

does it go as /public/info.rhtml
or
/public/info/index.rhtml?

I'm not really getting either to work.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

MrSaturn posted:

does it go as /public/info.rhtml
or
/public/info/index.rhtml?

I'm not really getting either to work.

/public/contact.html

The URL for this should end up like this: http://example.com/contact.html

If you wanted some dynamic stuff on the page you'll have to make a new controller/view.

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

MrSaturn posted:

This is a question so stupid, I can't believe I'm asking it, but:

how do I link to a static page within my domain? I want to make a contact page for my application, but there's no dynamic content to be put on it. I tried making app/views/contact/index.rhtml, and I got a routing error when I pointed my browser there.

where do I put a page to link to, say
localhost:3000/contact?

If it's purely static, you can put it in public as people have mentioned, but if you want to do stuff like use layouts, an easy way to do it is to create a controller

script/generate Controller contact

The controlller doesn't need any methods. Even without actions defined it'll look for the view for whatever file you request, so your above url/file should work. I suspect you got the routing error due to not having a contact controller.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.

Disclaimer: Very new to RoR.

I've been building a small project recently and have been using migrations to build my database since apparently it's the best way to do it (?) and I'm trying to get used to The Rails Way. I realized that a migration I just created to change a field was pretty stupid so I wanted to roll back to the version beforehand. Of course, being the idiot that I am I just had to write this code...

code:
class ChangeDateToDatetime < ActiveRecord::Migration
  def self.up
    change_column :releases, :created_at, :datetime, :default => Time.now
  end

  def self.down
    raise ActiveRecord::IrreversibleMigration
  end
end
So no rolling back for me. My question is, how do I do this manually and cleanly? I tried commenting out that exception and running rake db:migrate VERSION=3 (the above file is 004_...) but nothing appears to have happened. Should I delete the entire migration file, manually editing the version number in the scheme_info table and then running rake db:schema:dump? Or will this have undesired consequences? Thanks.

Hammertime
May 21, 2003
stop

SeventySeven posted:

Disclaimer: Very new to RoR.

I've been building a small project recently and have been using migrations to build my database since apparently it's the best way to do it (?) and I'm trying to get used to The Rails Way. I realized that a migration I just created to change a field was pretty stupid so I wanted to roll back to the version beforehand. Of course, being the idiot that I am I just had to write this code...

...
So no rolling back for me. My question is, how do I do this manually and cleanly? I tried commenting out that exception and running rake db:migrate VERSION=3 (the above file is 004_...) but nothing appears to have happened. Should I delete the entire migration file, manually editing the version number in the scheme_info table and then running rake db:schema:dump? Or will this have undesired consequences? Thanks.

In the process of scoping out the model/database design for my latest project, I've hosed up my migration files a bunch of times through having them abort half way (and leave a table), thanks to mispelling table names etc.

Load up mysql, drop the database, create it, run "rake db:migrate" on the now empty database.

There are a variety of ways to get around your situation, but I don't think it's worth the effort. I just fix it up, then go from scratch.

For me, sometimes rake just starts flaking out for both increasing and decreasing the database version. It runs, doesn't do anything, and doesn't create any output. Again, I just clear out the database and go from scratch. Reality is, rake is an awesome but buggy/immature tool.

Edit:

Oh, and assuming this is a pre-production system. Don't bother creating separate migration files for an alter column. It's easier to migrate back to version 0, change the table declaration to include the column, and rake it back to the latest version. Before you actually push the system live, the practice is to group all the migration files together into a single file (not including sample/starting data if you have any). Ideally there's a migration file for each version of the system that gets pushed into production, having separate migration files for development is just a temporary measure.

Hammertime fucked around with this message at Sep 24, 2007 around 08:51

jonnii
Dec 28, 2002
god dances in the face of the jews

SeventySeven posted:

Disclaimer: Very new to RoR.

What was the column before hand? Were you just adding the constraint?

Sewer Adventure
Aug 25, 2004


I develop in Seaside. For you people talking about state take a look at it, it will blow your mind.

Evil Trout
Nov 15, 2004

Despite rumors to the contrary, I do not love cocks.

Hammertime posted:

Oh, and assuming this is a pre-production system. Don't bother creating separate migration files for an alter column. It's easier to migrate back to version 0, change the table declaration to include the column, and rake it back to the latest version. Before you actually push the system live, the practice is to group all the migration files together into a single file (not including sample/starting data if you have any). Ideally there's a migration file for each version of the system that gets pushed into production, having separate migration files for development is just a temporary measure.

This can actually be dangerous unless you are the only person working on the project. If multiple people are checking out your source, going back and editing earlier revisions is sure to ruin their day Just a warning for the new guys.

Hammertime
May 21, 2003
stop

Grob posted:

This can actually be dangerous unless you are the only person working on the project. If multiple people are checking out your source, going back and editing earlier revisions is sure to ruin their day Just a warning for the new guys.

Very wise words.

My prototype was a 1-man show. It's only now scaling up to a small project team(3ish devs). I do believe it's worth consolidating the migrations assuming you communicate it with other team members and make sure everyone has their work checked in.

You remind me of how I dislike working with version control in RoR

I find the generators in ruby just make it more awkward to add all the new files to subversion. If only there was some magical versioning solution.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

Hammertime posted:


I find the generators in ruby just make it more awkward to add all the new files to subversion. If only there was some magical versioning solution.

code:
./script/generate scaffold_resource Whatever name:string --svn
This will add your generated files into SVN automatically.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.

Hammertime posted:

Oh, and assuming this is a pre-production system. Don't bother creating separate migration files for an alter column. It's easier to migrate back to version 0, change the table declaration to include the column, and rake it back to the latest version. Before you actually push the system live, the practice is to group all the migration files together into a single file (not including sample/starting data if you have any). Ideally there's a migration file for each version of the system that gets pushed into production, having separate migration files for development is just a temporary measure.

Okay, I'll probably just futz around with it to get it back to normal, since this is only development, not production.

jonnii posted:

What was the column before hand? Were you just adding the constraint?

I changed it from :date to :datetime and added the default value. Neither were necessary.

Grob posted:

This can actually be dangerous unless you are the only person working on the project. If multiple people are checking out your source, going back and editing earlier revisions is sure to ruin their day Just a warning for the new guys.

Duly noted. This is currently just a personal project without source control but I'd like to add another developer or two and SVN if this ever sees the light of day.

Hammertime
May 21, 2003
stop

vg8000 posted:


code:
./script/generate scaffold_resource Whatever name:string --svn
This will add your generated files into SVN automatically.

...

...

I had no idea, thankyou.

Adbot
ADBOT LOVES YOU

The Journey Fraternity
Nov 25, 2003




"./script/generate X foo -c" will add it to SVN as well, if you like saving three keystrokes v:)v

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply
«141 »