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
Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Don't listen to these guys. Ruby users happens to largely be Mac users and they'll waste no opportunity to try to tell you a Mac is better for everything ever done. While it's true that a Mac may have more support for RoR, Windows certainly isn't impossible by any means (installing cygwin? really? that's like some windows admin not knowing how to work with OS X, so he installs VMWare with Windows.)

If you want Ruby 1.8, go grab InstantRails and update the gems to whatever you want. The version of ruby in there, 1.8.6, is a little old, but RubyEE is the same version so you'll live. If you want Ruby 1.9, go here to get the One Click installer for Windows and then just install the gems by hand (just remember to install it in a directory path with no spaces, such as C:\Ruby19.) I've had no problems getting all the gems I need, although I did need the development kit from the One Click installer link above in order to get ruby-debug-ide for my IDE. Even Mongrel worked right the first time.

Yes, you will need to use the command line for a lot of stuff, but it's not a big deal. I personally use my IDE, RubyMine, to do a lot of the stuff I would normally do at the command line, but there's no reason you couldn't just use the command line itself. The Windows command line does suck a bit, though. Maybe check out that Console2 app linked above?

And if you're feeling envious of TextMate on OS X, try out the e text editor on Windows. It's a pretty close analog of TextMate -- it can even use TextMate bundles.

Really, the only world of suck I've found on Windows is using git. There is a version of git for Windows, but there's no good GUI for it yet, and using a VCS from the command prompt (even in Linux or OS X) always annoyed me to no end.

Obviously you wouldn't want to deploy on Windows, and perhaps if you get to the level where you need complicated scripts for running tests and other production work then Windows would start to lose its luster. But I figure by the time you get to that point you won't have a problem dropping $2k on a second computer.

Magicmat fucked around with this message at 09:01 on Oct 23, 2009

Adbot
ADBOT LOVES YOU

hmm yes
Dec 2, 2000
College Slice
What thread are you reading magicmat it sounds much more interesting and fictional than the one i am in

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

atastypie posted:

What thread are you reading magicmat it sounds much more interesting and fictional than the one i am in
haha, perhaps. It just seems that every time someone asks about Windows stuff, there are 3-4 posts of people trying to dissuade him or her from even using Windows for Ruby stuff at all. And worse, it seems that the people dissuading the poster are not Windows users themselves, and don't have a good grasp of the ins-and-outs of using Ruby on Windows.

Like I said, it takes a bit of work, and there are some downsides, but it's not so horrible that someone should ditch their entire OS, or even computer, just to do some RoR development.

hmm yes
Dec 2, 2000
College Slice
Yeah, you're right, I'm just poking fun

Pardot
Jul 25, 2001




But really, rails is done on macs :haw:


As a community, we probably should make more of an effort to help out the windows folks. That said, I have no clue how.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought
I see nothing wrong with encouraging people to use better tools. A Unix-based environment is undeniably better for running most programming language environments. We only suggest Macs because we love Textmate and they're the best vendor of Unix-based laptops.

If you want to put Ubuntu on your desktop or buy one preloaded with it from Dell, more power to ya! It'll work great and it is just as easy to find support as it is for OS X. You'll spend less time setting up a dual-boot Ubuntu setup than you will trying to track down windows versions of gems with compiled components.

Really, I evangelize Ubuntu/Debian as much as I do Apple. I might say a similar thing to someone running CentOS, for instance.

NotShadowStar
Sep 20, 2000

Magicmat posted:

haha, perhaps. It just seems that every time someone asks about Windows stuff, there are 3-4 posts of people trying to dissuade him or her from even using Windows for Ruby stuff at all. And worse, it seems that the people dissuading the poster are not Windows users themselves, and don't have a good grasp of the ins-and-outs of using Ruby on Windows.

Like I said, it takes a bit of work, and there are some downsides, but it's not so horrible that someone should ditch their entire OS, or even computer, just to do some RoR development.

C-based Ruby extensions on Windows.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

Operation Atlas posted:

I see nothing wrong with encouraging people to use better tools. A Unix-based environment is undeniably better for running most programming language environments. We only suggest Macs because we love Textmate and they're the best vendor of Unix-based laptops.

If you want to put Ubuntu on your desktop or buy one preloaded with it from Dell, more power to ya! It'll work great and it is just as easy to find support as it is for OS X. You'll spend less time setting up a dual-boot Ubuntu setup than you will trying to track down windows versions of gems with compiled components.

Really, I evangelize Ubuntu/Debian as much as I do Apple. I might say a similar thing to someone running CentOS, for instance.
See, this is what I'm talking about. If this were an OS thread, you would be completely warranted in your evangelism. But when somebody asks "how do I get RoR set up on Windows?" the correct response is never "change your entire OS" or "buy a new computer" unless they're specifically looking to install a new OS or buy a new computer centered around RoR development.

Turn the tables. Imagine if every time somebody asked something about TextMate or getting Ruby 1.9 from apt-get or something I would come in and post "ugghhh you really should be using Windows for this. It does nearly everything your computer does but has way better general application support and is cheaper/easier to use." True or not (ps: don't argue whether that is true or not I don't care it was just an example of a troll) that probably wasn't the answer the person was looking for.

NotShadowStar posted:

C-based Ruby extensions on Windows.
True, they can be if the C extension are very specifically coded just for *nix. But I've found most pretty cross-platform (or at least POSIX compliant.) And after unzipping the ruby devkit linked above, compiling these extensions is a no-brainer. To install mongrel from source, even in Ruby 1.9, I just typed "gem install mongrel" and Ruby Gem grabbed the source and compiled the whole thing for me. All of this without having to do anything other than unzip an archive -- no messing about with setting up my own C dev environment or setting up environmental variables or anything.

Yes there will be C extensions that don't work. I'm sure you could easily find half a dozen right now. But so far, at this admittedly early stage in my game, I've yet to encounter one in my everyday work.


So if there's one take-away from this, it's to stop turning Ruby on Rails into a vector for OS evangelism, and if you don't know how to do something on Windows you should probably refrain from answering someone's Windows question instead of telling them to switch to an OS you do know how to do it on.

Magicmat fucked around with this message at 21:52 on Oct 23, 2009

NotShadowStar
Sep 20, 2000

Magicmat posted:

See, this is what I'm talking about. If this were an OS thread, you would be completely warranted in your evangelism. But when somebody asks "how do I get RoR set up on Windows?" the correct response is never "change your entire OS" or "buy a new computer" unless they're specifically looking to install a new OS or buy a new computer centered around RoR development.

Turn the tables. Imagine if every time somebody asked something about TextMate or getting Ruby 1.9 from apt-get or something I would come in and post "ugghhh you really should be using Windows for this. It does nearly everything your computer does but has way better general application support and is cheaper/easier to use." True or not (ps: don't argue whether that is true or not I don't care it was just an example of a troll) that probably wasn't the answer the person was looking for.
True, they can be if the C extension are very specifically coded just for *nix. But I've found most pretty cross-platform (or at least POSIX compliant.) And after unzipping the ruby devkit linked above, compiling these extensions is a no-brainer. To install mongrel from source, even in Ruby 1.9, I just typed "gem install mongrel" and Ruby Gem grabbed the source and compiled the whole thing for me. All of this without having to do anything other than unzip an archive -- no messing about with setting up my own C dev environment or setting up environmental variables or anything.

Yes there will be C extensions that don't work. I'm sure you could easily find half a dozen right now. But so far, at this admittedly early stage in my game, I've yet to encounter one in my everyday work.


So if there's one take-away from this, it's to stop turning Ruby on Rails into a vector for OS evangelism, and if you don't know how to do something on Windows you should probably refrain from answering someone's Windows question instead of telling them to switch to an OS you do know how to do it on.

Except we're not evangelizing. It really does suck poo poo still on Windows, and Ubuntu is still terrible unless complied from source. Your example is terrible because the Ruby community pretty much uses Macs or some form of Linux, and kinda offhand does Windows whenever they care (nobody does). So the fact of the matter is that it's going to work much better on non-Windows because that's how the community works.

So really, you can gently caress around on Windows, download some weird Ruby pre-compiled stuff that hasn't been updated in 9 months, gently caress Around Endlessly to try and get the goddamn thing to function, maybe, and then you maybe start learning Rails. Getting Ruby and cohort working on Windows for someone who has never really worked with it is an exercise in pain, even today.

Or on a decent Linux distro, all you have to do is 'gem install rails' and 'gem install mysql' and 'gem install sqlite3'. Done, you're ready for Rails. On OSX, you need to install the Dev Tools CD and the do the same (or not even, OSX comes with Rails but it's typically outdated).

Working with Ruby and Rails on Windows is like equivalent to doing iPhone development on Windows, or .NET on Linux. Yeah, you probably COULD do it, but you better know how first because it's not going to be pleasant.

Ghotli
Dec 31, 2005

what am art?
art am what?
what.
This guy said what I wanted to say but better. Installing Ubuntu inside of VirtualBox or VMWare is going to be much less painful than attempting to learn rails on windows.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

NotShadowStar posted:

Except we're not evangelizing. It really does suck poo poo still on Windows, and Ubuntu is still terrible unless complied from source. Your example is terrible because the Ruby community pretty much uses Macs or some form of Linux, and kinda offhand does Windows whenever they care (nobody does). So the fact of the matter is that it's going to work much better on non-Windows because that's how the community works.

So really, you can gently caress around on Windows, download some weird Ruby pre-compiled stuff that hasn't been updated in 9 months, gently caress Around Endlessly to try and get the goddamn thing to function, maybe, and then you maybe start learning Rails. Getting Ruby and cohort working on Windows for someone who has never really worked with it is an exercise in pain, even today.

Or on a decent Linux distro, all you have to do is 'gem install rails' and 'gem install mysql' and 'gem install sqlite3'. Done, you're ready for Rails. On OSX, you need to install the Dev Tools CD and the do the same (or not even, OSX comes with Rails but it's typically outdated).

Working with Ruby and Rails on Windows is like equivalent to doing iPhone development on Windows, or .NET on Linux. Yeah, you probably COULD do it, but you better know how first because it's not going to be pleasant.
But that's my point: you're wrong. It isn't as big a pain as you make it out to be.

You want to know how to get a fully working version of Ruby 1.9, Rails and MySQL? Here, read this. 12 plainly-laid-out steps to getting the whole shebang. The blog post you linked to was simply a retelling of the exact blog post I linked to, but retold by someone for whom English isn't his primary language, and with code typos. In fact, when you Google "ruby 1.9 mysql windows", the blog post I linked to is the second result, meaning you had to dig to purposefully find a poorly-written version. So kudos on that, I guess?

And, of course, if you only want Ruby 1.8 (which most people are still using these days anyway) then there's one simple GUI installer that installs Ruby, Rails, MySQL and a ton of other extras, configures them, and even gives you a nice GUI to manage all of them from. (By the way, this method is laid out right in the opening chapters of the Rails book.)

Is installing Ruby 1.9 on Windows more complicated than OS X? Yeah, probably. But if having to follow 12 steps to install a dev environment is enough to make you change OS's, then maybe programming isn't for you?

Windows will have quirks, sometimes things won't work as easily, and sometimes you'll have to google stuff. And, yes, I'd recommend keeping a Linux VM around for production testing and the like (nginx and Phusion Passenger still don't have Windows support.) But for someone who simply wants to get started in RoR programming, making them ditch their entire OS to save 12 steps of work is a completely lopsided equation.

Doing all you dev work inside a VM is a lot more palatable, but I think the segregation of a VM makes things harder to use daily than taking the up-front time to get Ruby working on Windows in the first place. That's just me, though; others may like that option better.

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Man my question has started a war D:

I appreciate all the help though. I'm gonna stick with the Windows environment for now. As mentioned I am still learning, not a total noob, but still learning.
So it should do me fine I'd wager.

My production environment is a Unix server, hopefully the crossover there won't be an issue though...

Appreciate all the help!

derdewey
Dec 3, 2004
Hey! How about a real question! I'm a merb refugee waiting for the day when Rails 3 is strutting its stuff. I'm finally lazy enough to start request spec'ing and I need some serious pointers on how I should do this properly. This is done using rspec and webrat on a merb app.

http://pastie.org/private/ylzougyd3xlrvvaab0xra

I'm spec'ing a survey process. You follow a link in an email, it gives you a spiel and gives you a link to follow to really start the survey. You click it, then you answer the one question on the page. It does some redirects and plops you at a thank you page.

This spec is murderous unreadable and thus very unlikeable. But it works. Any tips on making it likeable?

derdewey fucked around with this message at 09:32 on Oct 26, 2009

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

derdewey posted:

Hey! How about a real question! I'm a merb refugee waiting for the day when Rails 3 is strutting its stuff. I'm finally lazy enough to start request spec'ing and I need some serious pointers on how I should do this properly. This is done using rspec and webrat on a merb app.

http://pastie.org/private/ylzougyd3xlrvvaab0xra

I'm spec'ing a survey process. You follow a link in an email, it gives you a spiel and gives you a link to follow to really start the survey. You click it, then you answer the one question on the page. It does some redirects and plops you at a thank you page.

This spec is murderous unreadable and thus very unlikeable. But it works. Any tips on making it likeable?

I like to separate testing the view and the controllers. Basically you should have a set of tests that does the requests you want and makes sure you get the proper response codes and the right poo poo happens to the objects, and another set of tests that renders the templates using mocks and makes sure the output is what you want.

I almost never test views, though. If it gets to the point where I need to test a view, I cook up something with Selenium and do it that way.

Pardot
Jul 25, 2001




derdewey posted:

This is done using rspec and webrat on a merb app.

Have you looked at cucumber? It's awesome and would do a lot to make your thing more readable. http://cukes.info/ . It uses webrat out of the box, however I'm using celerity so I can also get javascript to work and still stay headless.

Sewer Adventure
Aug 25, 2004
Hey guys I made a plugin because the Ack/grep bundles were good but not quite good enough
http://github.com/briancollins/nice_find

dustgun
Jun 20, 2004

And then the doorbell would ring and the next santa would come

Sewer Adventure posted:

Hey guys I made a plugin because the Ack/grep bundles were good but not quite good enough
http://github.com/briancollins/nice_find
You are a good person.

Ferg
May 6, 2007

Lipstick Apathy
Since this appears to be the only dedicated Ruby thread, is there a book on Ruby that would be the equivalent to "Dive Into Python"? I'm getting into Ruby to begin working with Watir for automated testing at work, and would like a really solid reference book. Dive Into Python is my model textbook, which is why I ask.

Anveo
Mar 23, 2002

Ferg posted:

Since this appears to be the only dedicated Ruby thread, is there a book on Ruby that would be the equivalent to "Dive Into Python"? I'm getting into Ruby to begin working with Watir for automated testing at work, and would like a really solid reference book. Dive Into Python is my model textbook, which is why I ask.

I think the "Pickaxe" book is generally considered the definitive reference.

NotShadowStar
Sep 20, 2000
Well the definitive 'reference' would be the book written by the man himself.

But it is a reference book, not a learning book, and covers every strange corner of the language which is way more information than most need.

FinkieMcGee
May 23, 2001

Look, I have to go identify our dead father's body. I'm sorry you're having a bad drug experience, but deal with it.
Anyone have any suggestions for Ruby on Rails shopping carts? I've looked at Substruct and Spree, both seem okay (though I might need to add a good bit of my own functionality), just wondering if there were any other reasonable options out there.

Randuin
Dec 26, 2003

O-Overdrive~
Starling/Workling seems to be one of those combos that don't work in Windows. Anyone have success getting background processing plugins to work under windows? And which ones?

invid
Dec 19, 2002
Has anyone found any blog publishing system on rails that is similar to wordpress in terms of functionality and plugins? I've been searching for a while and have yet to find any.

NotShadowStar
Sep 20, 2000
Why not just use Wordpress? I do that and deploy Rails apps in sub-URI using Passenger. Yeah its two separate systems but it's really not so bad.

Randuin
Dec 26, 2003

O-Overdrive~
I ended up using delayed_job, a database driven queue along with a very easy to use and execute daemon.

Dum Cumpster
Sep 12, 2003

*pozes your neghole*
I've got a validation question and I'm new to rails/web programming so you might need to respond in simple sentences. I've got a form where I'm getting data from the user and having them select a pre-existing object using a collection select box. From the model's controller I use the data to make a calculation, display the result, and then don't care about the data or the object selected beyond that. So I'm wondering how I validate the user's data without having a model and also how to make sure that an object was selected. I've looked into it a bit but I'm not sure if something like ActiveForm is appropriate to what I'm doing.


What would be the best way to go about this/how horrible is the current way I'm doing things?

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

Dum Cumpster posted:

I've got a validation question and I'm new to rails/web programming so you might need to respond in simple sentences. I've got a form where I'm getting data from the user and having them select a pre-existing object using a collection select box. From the model's controller I use the data to make a calculation, display the result, and then don't care about the data or the object selected beyond that. So I'm wondering how I validate the user's data without having a model and also how to make sure that an object was selected. I've looked into it a bit but I'm not sure if something like ActiveForm is appropriate to what I'm doing.


What would be the best way to go about this/how horrible is the current way I'm doing things?

Something smells funny about this, but I'll just answer it straightforward: An if statement, and then putting something in flash[:notice].

Dum Cumpster
Sep 12, 2003

*pozes your neghole*

Operation Atlas posted:

Something smells funny about this, but I'll just answer it straightforward: An if statement, and then putting something in flash[:notice].

It's that simple? I keep seeing that the model's supposed to handle validation and not the controller. I'm apparently making this way too complicated.

NotShadowStar
Sep 20, 2000
Validations are used in AR models to ensure consistency going in a database. If it's not going in anywhere you can never validate.

It sounds like you're doing some sort of web-based calculator type thing based upon values in a database somewhere. If that's the case you could do the whole thing in Javascript.

Dum Cumpster
Sep 12, 2003

*pozes your neghole*

NotShadowStar posted:

Validations are used in AR models to ensure consistency going in a database. If it's not going in anywhere you can never validate.

It sounds like you're doing some sort of web-based calculator type thing based upon values in a database somewhere. If that's the case you could do the whole thing in Javascript.

Yeah, I'm understand that now. I'm planning on having all the data go into a database later, just doing it screwy in this early version to see how it would work. I figured the more I fight with rails to get different things to work the better I'll understand it. I could be wrong but I'm learning a bit.

NotShadowStar
Sep 20, 2000
Don't screw with Rails in that manner. The more you fight with it and try and treat it like a pretty PHP the more frustrated you're going to get. If it's going to go in a database later, don't waste your life with some weird prototyping without the database, just create a database and the model to go with it and work with validations the way you're supposed to. Rails makes it dead simple to separate development data from real data so there's no danger in blowing up your development databases and restarting from scratch if you're going in the wrong direction.

Dum Cumpster
Sep 12, 2003

*pozes your neghole*

NotShadowStar posted:

Don't screw with Rails in that manner. The more you fight with it and try and treat it like a pretty PHP the more frustrated you're going to get. If it's going to go in a database later, don't waste your life with some weird prototyping without the database, just create a database and the model to go with it and work with validations the way you're supposed to. Rails makes it dead simple to separate development data from real data so there's no danger in blowing up your development databases and restarting from scratch if you're going in the wrong direction.

Ok, I'll quit screwing around then. Thanks for the advice.

NotShadowStar
Sep 20, 2000
Here's the thing with Rails: it does things in particular ways because the design of it is taking a stand, stating an opinion on how the people behind it thinks things should work. The original creator even calls it 'opinionated software'. In that sense Ralis is like Apple products, if you mostly think along the same lines it's great, but if you have a totally different opinion there aren't a lot of accommodations for you. So if you're working with it and you're not digging it, that's cool there's lots of good web frameworks now, but give it a fair shot and work with it how it was designed.

Dum Cumpster
Sep 12, 2003

*pozes your neghole*

NotShadowStar posted:

Here's the thing with Rails: it does things in particular ways because the design of it is taking a stand, stating an opinion on how the people behind it thinks things should work. The original creator even calls it 'opinionated software'. In that sense Ralis is like Apple products, if you mostly think along the same lines it's great, but if you have a totally different opinion there aren't a lot of accommodations for you. So if you're working with it and you're not digging it, that's cool there's lots of good web frameworks now, but give it a fair shot and work with it how it was designed.

Thanks again. I'm sure you're saving me from a bunch of frustration.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought
Thanks, NSS, that's what I was trying to say but I didn't have the energy for it.

Pardot
Jul 25, 2001




It's also a case of once you learn all the rules, then you can break them and get away with it. But definitely not before.

I'm using couchdb as my storage, so I'm not using Active Record. It's wasn't so bad swapping it out, but I wouldn't suggest it to anyone who hasn't built a few rails apps already.

Although I'm really loving looking forward to active model in rails 3. Speaking of, have any of you tried out the new gem bundler yet?

Sharrow
Aug 20, 2007

So... mediocre.
It's either laziness or ineptitude, but it seems to take me far too long to get a skeleton app running. Writing code and tests for things like password resets bores the hell out of me.

Does anyone use templates for new applications, or even skeleton apps?

thoughtbot-suspenders looks interesting. Even if it does say, use Clearance over Authlogic, I figure if it comes with tests then getting to know an alternative gem isn't necessarily a bad thing.

NotShadowStar
Sep 20, 2000
You can write your own generators. I've done this a couple times, and even though the article is 2 years old it still looks mostly relevant.

stack
Nov 28, 2000
I'm new to rails and need some help in getting my app going the rails way.

The application is for doctor offices and each office should be sectioned off from other data any other office enters. I've added office ids to the various models but now I'm scratching my head.

I have declarative_authorization installed and want to use it to limit things like Patient.save to only the patients whose office id matched the logged in users office id. I also want to err magic in the users office id into all the various models which they create. So if a user creates a new Patient or Schedule record the office id gets put in magically.

How do I accomplish these?

Adbot
ADBOT LOVES YOU

NotShadowStar
Sep 20, 2000
If the offices are distinctly independent, then the easiest solution I can think of is multiple instances of the Rails project each with a different database.

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