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
Physical
Sep 26, 2007

by T. Finninho

A MIRACLE posted:

That seems like a lot of work done in the view layer. Physical have you tried moving some of that logic to the model to see if that simplifies things a bit?
Yea I'm still early in this so this is my first draft. this much logic should be moved to the controller.

Also, the way I worked around this was that I just started use hash.each and just use the key part to get an index to whatever section I want to edit. My first post seemed convoluted, but at the time I thought that I could add a hash to the value and it would still be visible by data. I didn't think it all the way through. Thanks for the tips!

Adbot
ADBOT LOVES YOU

prom candy
Dec 16, 2005

Only I may dance

Physical posted:

Yea I'm still early in this so this is my first draft. this much logic should be moved to the controller.

Complex logic belongs in the model, or abstracted even further into modules. http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model

As far as the code you posted, I'm making some assumptions about what you're trying to do but does this cover it? Are you trying to replace hash keys or just add to a hash?

code:
@plan.departments.map(&:staff).each do |staff|
  data[staff.department_id.to_s] = staff if data.has_key?(staff.location_id.to_i)
end

Cock Democracy
Jan 1, 2003

Now that is the finest piece of chilean sea bass I have ever smelled
Any ideas on this extremely frustrating problem?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Yeah Physical, remember Fat Models, Skinny Controllers. Your controllers (in conjunction with the router) are basically for matching requests with the appropriate responses, no more.

e: any goon ops hiring Ruby devs right now? I'm thinking about leaving my .NET job and pursuing Ruby development full-time. And I wanna see what's out there...

A MIRACLE fucked around with this message at 23:38 on Mar 28, 2012

Evil Trout
Nov 16, 2004

The evilest trout of them all
For those interested, Yehuda Katz is kickstarting a new project to improve Rails on OSX:

http://www.kickstarter.com/projects/1397300529/railsapp

I just kickstarted it. I think it's a great idea.

Now if only someone would do the same for Windows!

Strong Sauce
Jul 2, 2003

You know I am not really your father.





So we are suppose to pay him money to "fix" Rails in Mac OSX because he/they made it way too complicated?

Edit: Oh I see he's making a Mac app. Now the complaints about, "does Yehuda Katz know ObjC?" make more sense

Strong Sauce fucked around with this message at 01:42 on Mar 29, 2012

Oh My Science
Dec 29, 2008
I understand the appeal of having an all-in-one app to setup my rails enviroment, it just doesnt seem neccessary with tools like brew, bundler and rbenv. Just last night I made the switch to rbenv after a system format and it only took me 10-15 minutes to be up and running again. Has the setup process become too difficult for developers to handle?

Just to be clear, is he trying to make a RoR GUI editor as well? Or just a tool to manage your gems and ruby installs?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Hmm I'm still using RVM, guess I'm a noob. But if anything can simplify the Postgres install, sign me up. Although I heard Heroku was building a better management tool which would be super handy.

Pardot
Jul 25, 2001




A MIRACLE posted:

Hmm I'm still using RVM, guess I'm a noob. But if anything can simplify the Postgres install, sign me up. Although I heard Heroku was building a better management tool which would be super handy.

I will help you set up postgres, post any problems you have. I personally just use homebrew for what it's worth.

The tool you're talking about is this http://inductionapp.com/ which while cool, does not help in installing postgres. I'm thinking of making an mac app that run postgres for you, but :effort: and time.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Pardot posted:

I will help you set up postgres, post any problems you have. I personally just use homebrew for what it's worth.

The tool you're talking about is this http://inductionapp.com/ which while cool, does not help in installing postgres. I'm thinking of making an mac app that run postgres for you, but :effort: and time.

Oh, I have no problem setting it up now that I've done it a thousand times :). But it's a consistent roadblock when I'm trying to ramp up new users to Rails development, as they usually can't figure it out themselves.

Thanks for the helpful offer though. And I'll definitely check out Induction.

prom candy
Dec 16, 2005

Only I may dance
The headaches of setting up your development environment are good practice for the headaches of setting up your production environment and figuring out how to deploy! (Unless you're on heroku)

Evil Trout
Nov 16, 2004

The evilest trout of them all
I personally think it's a good idea to make any process easier for beginners.

I'm all about lowering barriers to entry and letting as many people through the door as possible.

Also I don't think it's fair to call Yehuda the originator of the difficulty installing Rails on a mac. Stuff like setting up rvm / rbenv / xcode never had anything to do with Rails.

He's only really responsible for the "bundle install" step, and after dealing with freezing gems and such in the past, that's a welcome change.

Trabisnikof
Dec 24, 2005

Evil Trout posted:

I personally think it's a good idea to make any process easier for beginners.

I'm all about lowering barriers to entry and letting as many people through the door as possible.

Also I don't think it's fair to call Yehuda the originator of the difficulty installing Rails on a mac. Stuff like setting up rvm / rbenv / xcode never had anything to do with Rails.

He's only really responsible for the "bundle install" step, and after dealing with freezing gems and such in the past, that's a welcome change.

I still don't understand how installing Rails on OS X is hard anymore. I mean, I remember the days that the ruby install was broken, but how is it difficult anymore?

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
I think half the difficulty on installing ruby on a mac (or anywhere, really), is that there's inconsistent guidelines and no straightforward, canoncial "hey, absolute beginner programmer, here's what you should do!"

Most beginners are probably going to have to deal with:

  • Starting with the system ruby until someone screams at them about how that's a horrible idea.
  • Downloading XCode for hours unless they were lucky enough to find something on the developer tools that don't require a full XCode install.
  • Hopefully figuring out that they need homebrew and not one of the more old-school package managers.
  • Be utterly confused about why people keep screaming at each other about how either RVM or rbenv are horrible and you should never use one or the other.
  • Hopefully find a recent guide and know that the version of ruby they need to install is 1.9.3.
  • (Fast forward two weeks) Wonder why they include the normal scripts in the first place when every single command ever needs "bundle exec" in front of it.

All of this is pretty much second nature to people who are used to rails, but if you're new to it, there's a lot of different options to consider, and even where there's a clear "right" option, there's still plenty of guides that refer to an outdated old option that should be avoided.

8ender
Sep 24, 2003

clown is watching you sleep
hardest part on a fresh install of osx is getting gcc setup and then finding the magic 25+ character incantation that allows the mysql gem to be compiled

Pardot
Jul 25, 2001




8ender posted:

hardest part on a fresh install of osx is getting gcc setup and then finding the magic 25+ character incantation that allows the mysql gem to be compiled

There is literally no reason to ever use mysqlol when you have the option to use postgres.

FamDav
Mar 29, 2008

enki42 posted:

I think half the difficulty on installing ruby on a mac (or anywhere, really), is that there's inconsistent guidelines and no straightforward, canoncial "hey, absolute beginner programmer, here's what you should do!"

Most beginners are probably going to have to deal with:

  • Starting with the system ruby until someone screams at them about how that's a horrible idea.
  • Downloading XCode for hours unless they were lucky enough to find something on the developer tools that don't require a full XCode install.
  • Hopefully figuring out that they need homebrew and not one of the more old-school package managers.
  • Be utterly confused about why people keep screaming at each other about how either RVM or rbenv are horrible and you should never use one or the other.
  • Hopefully find a recent guide and know that the version of ruby they need to install is 1.9.3.
  • (Fast forward two weeks) Wonder why they include the normal scripts in the first place when every single command ever needs "bundle exec" in front of it.

All of this is pretty much second nature to people who are used to rails, but if you're new to it, there's a lot of different options to consider, and even where there's a clear "right" option, there's still plenty of guides that refer to an outdated old option that should be avoided.

The updated list for 10.7 and beyond looks more like:

  • Starting with the system ruby until someone screams at them about how that's a horrible idea.
  • Downloading XCode for hours unless they were lucky enough to find something on the developer tools that don't require a full XCode install because command line tools are now a separate download within xcode.
  • Realize that the version of GCC it installs doesn't work with Ruby.
  • Have half the people to tell you to install using "--with-gcc=clang" and the other half telling you this is an awful idea. Figure out that it is a bad idea but have no idea how to fix it.
  • Find out that you have to install an alternative version of GCC. Find where to download that so you can finally install ruby 1.9.3
  • Hopefully figuring out that they need homebrew and not one of the more old-school package managers.
  • Be utterly confused about why people keep screaming at each other about how either RVM or rbenv are horrible and you should never use one or the other.
  • Hopefully find a recent guide and know that the version of ruby they need to install is 1.9.3.
  • (Fast forward two weeks) Wonder why they include the normal scripts in the first place when every single command ever needs "bundle exec" in front of it.

In short doing anything with Ruby is a pain in the rear end for beginners because Apple hasn't updated to 1.9.3 and Ruby doesn't support Clang yet.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!

Pardot posted:

There is literally no reason to ever use mysqlol when you have the option to use postgres.

Postgres isn't a walk in the park your first time either. I open pg_hba.conf and configure it without thinking twice about it now, but the first time I installed Postgres it was a complete pain in the rear end figuring out what was going on.

IsotopeOrange
Jan 28, 2003

Pardot posted:

There is literally no reason to ever use mysqlol when you have the option to use postgres.

Many of my clients request Amazon RDS, which doesn't support postgres yet

Physical
Sep 26, 2007

by T. Finninho
MySQL is sweet and no real business is going to use postgres (right)?

Even in my development environment I want it to be as close to production as possible, and that means using the respective database type. I thought this was the norm.

It would be like developing an iOS app on windows. Oh wait...

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

You realize there's a giant PaaS that uses Postgres exclusively, right? Not to jump down your throat but are you even reading the thread?

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Physical posted:

MySQL is sweet and no real business is going to use postgres (right)?

Please don't troll.

Physical posted:

Even in my development environment I want it to be as close to production as possible, and that means using the respective database type. I thought this was the norm.

It is. That's why we're talking about installing postgres locally. But maybe you misunderstand: you're supposed to choose the database based on what you want to have in production, then install the same one in dev, not the other way around.

Doc Hawkins fucked around with this message at 15:53 on Mar 30, 2012

Pardot
Jul 25, 2001




Doc Hawkins posted:

Please don't troll.

Well to be fair, I trolled first, which was bad. I'm sorry. However I do strongly believe that it's going to be your best option for data unless you need some sort of dynamo-style database, in which case I'd recommend riak.

prom candy
Dec 16, 2005

Only I may dance
Do you guys deploy mission critical apps to heroku? We have a pretty sweet production environment right now but it would be nice to get on the set-it-and-forget-it train. The only time I've ever deployed to heroku was that Saturday a month or so ago when it went down for two hours.

Physical
Sep 26, 2007

by T. Finninho
I'm not trolling. I said (right?) to ask for confirmation but I guess me not knowing everything there is infuriates you to the point that I must be trolling.

Doc Hawkins posted:

But maybe you misunderstand: you're supposed to choose the database based on what you want to have in production, then install the same one in dev, not the other way around.
I actually think you misunderstand because that is exactly what I said. Get dev to be as close to production.

Please don't troll.

Physical fucked around with this message at 16:02 on Mar 30, 2012

Pardot
Jul 25, 2001




prom candy posted:

The only time I've ever deployed to heroku was that Saturday a month or so ago when it went down for two hours.

I'm very sorry about that :smith:

prom candy posted:

Do you guys deploy mission critical apps to heroku? We have a pretty sweet production environment right now but it would be nice to get on the set-it-and-forget-it train.

For what it's worth, all of what I personally do is deployed to the platform itself. We're not entirely self-hosted yet, and it may not be possible, but that's the goal. http://www.infoq.com/presentations/Running-Heroku-on-Heroku if you find that interesting.

As for customer apps, there are lots and lots of very serious and large applications on heroku. I try to avoid selling here on SA since that seems like it'd be a lovely thing to do, so send me a PM if you want to know more.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

I use Heroku exclusively for my projects because finding good ops people is hard and gently caress if I'm ever touching a server. I break IIS enough to know I'm not the guy for that :). Also I must be the only person in Knoxville who knows what a Rails is.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Physical posted:

I'm not trolling. I said (right?) to ask for confirmation but I guess me not knowing everything there is infuriates you to the point that I must be trolling.

"Infuriate" is a very strong word.

quote:

I actually think you misunderstand because that is exactly what I said.

Suffice to say, there are reasons to prefer Postgres to MySQL, but if you've never run into or heard of them, then I guess there's no reason to change.

Trabisnikof
Dec 24, 2005

FamDav posted:

The updated list for 10.7 and beyond looks more like:

[list]
[*] Starting with the system ruby until someone screams at them about how that's a horrible idea.
[*] Downloading XCode for hours unless they were lucky enough to find something on the developer tools that don't require a full XCode install because command line tools are now a separate download within xcode.
[*] Realize that the version of GCC it installs doesn't work with Ruby.

In short doing anything with Ruby is a pain in the rear end for beginners because Apple hasn't updated to 1.9.3 and Ruby doesn't support Clang yet.

Wait, how come I did't have any of these issues when I just did an install from scratch, besides the Xcode nonsense which is very dumb. But other than that, I was able to install macports etc and start working away on Ruby poo poo, including imagemagik.

Someone should just make an installer that installs all the good parts of Xcode without installing Xcode.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.

Trabisnikof posted:

Someone should just make an installer that installs all the good parts of Xcode without installing Xcode.

You mean this?

VVVV: Cool, hadn't seen that before.

Smol fucked around with this message at 18:21 on Mar 30, 2012

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Smol posted:

You mean this?

Apple has made an 'official version' based off his stuff

http://kennethreitz.com/xcode-gcc-and-homebrew.html
http://developer.apple.com/downloads

Look for Command Line Tools for XCode

FamDav
Mar 29, 2008

Trabisnikof posted:

Wait, how come I did't have any of these issues when I just did an install from scratch, besides the Xcode nonsense which is very dumb. But other than that, I was able to install macports etc and start working away on Ruby poo poo, including imagemagik.

Someone should just make an installer that installs all the good parts of Xcode without installing Xcode.

Ah, I guess the problem is 10.8 specific then. I ran into this issue here and got to spend an hour or so fixing it.

asveepay
Jul 7, 2005
internobody

Physical posted:

MySQL is sweet and no real business is going to use postgres (right)?

The multi-million dollar company I work for utilizes Postgres for all of our primary production systems.

Pardot
Jul 25, 2001




I expect each and every one of you to see my talk at railsconf.

Pardot fucked around with this message at 22:20 on Dec 8, 2013

asveepay
Jul 7, 2005
internobody

Pardot posted:

I expect each and every one of you to see my talk at railsconf. It's about everyone's favorite database, postgres :v:

I'm totally there!

(unless the DB guys want to go instead)

prom candy
Dec 16, 2005

Only I may dance
My work seems uninterested in paying to send me to Railsconf and I don't even know if I can get my passport renewed by then. Will the talk be posted online?

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Pardot posted:

I expect each and every one of you to see my talk at railsconf. It's about everyone's favorite database, postgres :v:

We don't have anyone going to railsconf (I didn't care enough to push for it, going to scottish ruby instead, suck it), but I think I got the gist of it Thursday night even if postgres isn't a Dynamo-powered distributed key-value store.

CHRISTS FOR SALE
Jan 14, 2005

"fuck you and die"
A Ruby...On A Rail..

You don't DO that...

http://collectiveidea.com/blog/archives/2012/04/01/walken-on-rails/


Pardot posted:

I expect each and every one of you to see my talk at railsconf. It's about everyone's favorite database, postgres :v:
My company is paying for me to go to Philly ETE and not Railsconf sadly so I expect a stream! :)

manero
Jan 30, 2006

Anybody coming up to Minneapolis for JRuby Conf?

Adbot
ADBOT LOVES YOU

8ender
Sep 24, 2003

clown is watching you sleep
i cut my teeth on oracle a long time ago and really liked the way postgres was similar last time I used it

Is there anything as good as sequelpro or querious for postgres? I've been really spoiled by both of those tools and use them on a daily basis.

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