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
asveepay
Jul 7, 2005
internobody
Soooo...how many other people are really unhappy with the complete lack of documentation/guidance with 2.0? basically all of my books have become obsolete, so, yeah, kinda pissed.

Adbot
ADBOT LOVES YOU

asveepay
Jul 7, 2005
internobody

skidooer posted:

stuff

Thanks, skidooer, those links will come in handy. I'm not really just learning rails but I'm still at a beginner stage. I had completed a lot of work on an application and then 2.0 released just as I realized I had to rewrite a significant chunk of my app. So I thought it would be good to just start over using 2 and then reimport code where I could. However since I never used any of the plugins that have been folded into the 2.0 core it's a bit confusing having to cobble together information from the various mailing list postings. for instance, i had no idea .rhtml files had gotten the .erb extension till I saw some screencasts using this convention. also the model_path convention and <%=h blah %> was not one I had seen before either. Right now i'm basically forced to build portions using scaffold and then modifying that, which is not easy, especially sinc the API documents seems to also be not yet updated.

asveepay fucked around with this message at 13:09 on Dec 16, 2007

asveepay
Jul 7, 2005
internobody

Hammertime posted:

If you have a moment could you expand on what is the cause of the rewrite.

I've got a project sitting at 1.2.6, but was hoping to seamlessly upgrade to 2.0, I didn't realise there were any changes that would cause a re-write of a section.

I'm not rewriting because of 2.0 (not really, anyway) but I started trying to integrate a feature much too late and I couldn't figure out an efficient way to insert it without breaking everything and having to debug. So i thought I'd start over and hopefully be able to use the upgraded parts of 2.0 for a more efficient/bleeding-edge app. I can't think of any portion of my 1.2.6 application which doesn't still work fine aside from a few deprecation warnings, but definitely trying to do things the 1.2.6 way is not flying too high in 2.0 land.

asveepay
Jul 7, 2005
internobody

Overture posted:

Anyone else played with this yet?

http://heroku.com/

Edit: Getting an invite didn't take me long, but if you'd like an instant one post your email and I'll invite away.

I'm on it and I'm finding it pretty fun, although it took some work to get at it through my work firewall.

If you're just into noodling around with Rails like I am, Heroku is great. Instead of having to fire up InstantRails and an editor and a browser wherever I happen to be, I can just play with my code through a browser and instantly view the results.

PM me for an invite.

asveepay
Jul 7, 2005
internobody

Pardot posted:

You may also want to take a look at the Complex Rails Forms series at railscasts.

http://railscasts.com/episodes/73
http://railscasts.com/episodes/74
http://railscasts.com/episodes/75

This helped me immensely when I was trying to do the same thing a few weeks ago. You may have a little trouble getting it to work if you're only creating one additional child object however.

asveepay
Jul 7, 2005
internobody

Anveo posted:

Also, I have a legacy table for related products. All it has is a left_id and a right_id. What is the best way to accomplish this in rails? I looked into nested_set and acts_as_tree stuff, but that seems like it might be a bit much for this. I could do a normal join model, but I guess what is throwing me off is both columns will be pointing to the same class (Product).

I do something similar to this in one of my projects using Has And Belongs To Many. There is a table which contains user_id & community_id. Both have has_an_belongs_to_many set for each other in the model.

the tricky part for me was that normal table creation also adds an id column which had to be removed for it to work correctly, but otherwise it does exactly what you expect: for each user_id, there are X number of communities, and vice-versa.

on the other hand you are linking the same model to itself, which is slightly different, but still might work.

another option might be to create a new attribute of the product and use serialize to make an array of the values in it. then you can just push in new ids for related products

asveepay
Jul 7, 2005
internobody

Randuin posted:

I just have a question since the new thing seems to be running passenger/nginx. Is there any reason to use that combo during development at all?

I use apache/passenger, on my ubuntu machine, and it is awesome. once you set everything up (which takes like 10 minutes) it's total cake, it's always on and you never have to stop/start webrick. Just set a bookmark, and bam.

it is so choice. if you have the means I highly recommend it.

asveepay
Jul 7, 2005
internobody

jonnii posted:

Have you considered using heroku? It's pretty awesome.

For your wordpress you can get a 6 dollar a month account on bluehost.

I did a lot of early rails development with Heroku, and while I was incredibly happy with the hosting and web-based editor, i did come across a number of really weird artifacts with record sorting that seemed to only happen on Heroku, and not on any other hosts.

As such, I moved over to RailsPlayground for testing and have been pretty happy with my developer account there. Its certainly not a full site, but it runs well for my purposes.

asveepay
Jul 7, 2005
internobody

jonnii posted:

Heroku has likely changed significantly since you last tried it, they don't have any of that web based editor anymore. I think you'll be pleasantly surprised...

I've run on it since they switched to all hosting, and my projects still suffered from the same sorting issue, which was significant since they both placed high value on the position of returned objects. I ended up writing a lot of code for the first one (a forum) that would pull out the first post from a thread and display it separately since it often ended up (especially if it was edited) near the bottom. When a similar issue happened to another, totally unrelated project, but only on Heroku, is when i became suspicious.

I still have my account there but I haven't used it lately.

The web editor was pretty keen for people who were developing on Windows, assuming it didn't crash, which it did on a regular basis. Now that I run off ubuntu that is a non-issue, however it was useful at the time.

asveepay
Jul 7, 2005
internobody

Obsurveyor posted:

Same segfaults unless I use 1.9.2. My post about beta2 was just when it started and when they said something. Note my "Rails 3 trunk" too, i.e. the latest version from git(as of Friday when I messed with it last at work) segfaults as well.

did you remove beta 1? There are a ton of errors if you try to keep both installed.

asveepay
Jul 7, 2005
internobody

Pardot posted:

hoptoadapp.com has a free plan, and they have an addon for 2 a month. The exception notification gem might be what you're looking for though It'll just send an email

We use exception notifier for a project at work, and it is pretty handy that way to find out about errors and fix them before someone logs a ticket

asveepay
Jul 7, 2005
internobody

Bob Morales posted:

Linux guys, what are you using for a development setup? Are you choosing a distribution that has a current version of Ruby and then just installing rubygems, or are you compiling your own stuff?

Ubuntu 10.04, rvm, build rubygems from source (stupid easy via instructions on their site), apache & passenger standalone

asveepay
Jul 7, 2005
internobody

Cock Democracy posted:

... And redcar for editing.


is Redcar good now? I used it until they started building the new version, and then the development lagged so much I uninstalled it and switched to VIM, then gedit. One of my coworkers has been using redcar as well but he seems kinda 'meh' about it.

asveepay
Jul 7, 2005
internobody

smug forum rear end in a top hat posted:

I'm starting to use OmniAuth. If I'm understanding correctly, it only connects with the Facebook API when a user needs to be authorized. Can I pull data from a user's facebook profile at will with OmniAuth?

(I'm working from Ryan Bates' set of OmniAuth Railscasts here.)

In my experience, no you can't, but you do get a bunch of data back from facebook when they authenticate which you could save and process later.

asveepay
Jul 7, 2005
internobody
At Windy City Rails last weekend, Nic Williams did a decent talk about using threaded concurrency to wring performance out of your app without having to run a zillion Ruby processes that all utilize 150-200MB of Ram.

Instead he espoused the use of an evented web server with a low memory footprint (nginx) and a threadsafe web server (trinidad) along with a threadsafe implementation of rails (Ruby 1.9.2 & Rails 3 with config.threadsafe set to true). He also had a couple interesting slides about memory performance between nginx and apache.

Of course, trinidad requires Jruby, JDBC gems setup and a host of other changes. I spent the rest of the weekend playing around with it, but didn't get too far since my nginx skills are quite terrible, and work sprang up to occupy my attention.

Anyhow, the talks should be up soon and that one was one of the more interesting ones from Saturday.

asveepay
Jul 7, 2005
internobody

Lamont Cranston posted:

Does anyone know how I can include associated objects in a query according to a scope? I have Companies with many Jobs, but Jobs expire after a certain amount of time, so when I do Company.includes(:jobs) I want to be able to limit what it includes to just active jobs. Is there any way to do this? I already have an 'active' scope on Jobs, and I was hoping I would be able to reuse that, but I'll take anything.

You can reuse scopes, just provide the name in the includes:

code:
Company.includes(:active_jobs)
If you're using it in a view, like in a collection, then:

code:
<%= select_tag(:job_id, option_groups_from_collection_for_select(Company.includes(:jobs).all, :active_jobs, :company_name, :id, :job_name), :include_blank => true) %>

asveepay
Jul 7, 2005
internobody
so who's heading to Austin this april?

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.

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)

asveepay
Jul 7, 2005
internobody
Try: http://api.rubyonrails.org/

asveepay
Jul 7, 2005
internobody

Physical posted:

Do you guys have any preferred gems for versioning/change logs? Stuff like this for example https://github.com/airblade/paper_trail

I attempted to insert paper_trail into a project at work but it doesn't seem to handle habtm associations very well (which is what I was attempting to track). I ended up just implementing a new join model with a separate model that tracks who made the changes.

asveepay
Jul 7, 2005
internobody

Physical posted:

Can you elaborate on what it failed to do? And did you keep using paper_trail? Is the problem with the habtm is that it just won't "reify" them? I'm not so concerned with that, I just want all my changes to my models to be documented.

Basically what we wanted to do was take a model "Job" which habtm "permissions" and track who made changes and approve those changes. Because a user could submit multiple changes at once, having the approval keep track of which permissions were and were not approved, who submitted them, and when, was just too much for simple versioning, so I abandoned it pretty quickly and created a join model with an associated approval model which was a lot more one-to-one for the permission and the approver.

For different types of changes I'm sure it would have been useful, but not for that one.

asveepay
Jul 7, 2005
internobody

Oh My Science posted:

I find myself wanting to Learn more about ruby, has anyone taken the ruby course from pragmatic studio? I could probably grab a book or two, but I'm partial to video tutorials.

several of the people on my team have taken this course, and while some of it was remedial for them, even the ones that are coding daily and inside console all the time found it educational.

asveepay
Jul 7, 2005
internobody
Haha! fortunately my company's rails stack is so old this vulnerability doesn't apply.

asveepay
Jul 7, 2005
internobody
You may also want to check out the PG Power gem: https://github.com/TMXCredit/pg_power
It adds some of this functionality to migrations in a more migration-y way, along with a bunch of other stuff that is "missing" from Rails migrations.

Adbot
ADBOT LOVES YOU

asveepay
Jul 7, 2005
internobody

kitten smoothie posted:

This only lets you use schemas in migrations, though; but what's best practice for actually using schemas in ActiveRecord models? I was using

code:
self.table_name = 'schema.tablename'
in the models but that seems like that's a little fishy.

This is how we do it at work, I'm not sure there's another option really.

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