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
hmm yes
Dec 2, 2000
College Slice
I'm looking to contract out a rails programmer to add some manpower to some new projects.

I'm not too worried about experience as long as you know how to use rspec and have good test coverage. You'll also need to know how to use SVN. I don't need you to know how to admin a server or how to do any html/design. Even if you can only pick up 15 hours a week, I'm interested in hearing from you.

Just send me an email introducing yourself and giving me a bit of your background. While not necessary, a sample project that includes specs would help me get to know your work--even if it's just a todo list. I'll also need to know your hourly rate.

mail to: REMOVED


edit: if you don't know rspec, but you DO know test::unit, please go ahead and email me anyways. We can work something out.

hmm yes fucked around with this message at 18:11 on Apr 14, 2010

Adbot
ADBOT LOVES YOU

Evil Trout
Nov 16, 2004

The evilest trout of them all

Hop Pocket posted:

I do love slicehost, but I'll be damned if gem does not work very well on a 256 slice. Very memory intensive. Installing one gem can take hours. I don't need a 512 slice, but am considering getting one just to make gem usage more palatable.

edit: 512 slice a billion times faster.

Considering rubygems is just a package management system, its resource usage is horrendous. Maybe it's doing some magic behind the scenes I'm unaware of, but simply updating the list of gems from the server can take up hundreds of megs of RAM.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Help!

I have a technical interview coming up for employment in a salary based role using Ruby on Rails. Up until now all of my professional work with Rails has been under contract and I've done or learned about only what I wanted to know.

I'm really nervous because I realize that -first of all- I want the job, but that I don't know dilly about what is expected when working with other programmers.

That's not true, I learned some about Microsoft SVN while I was getting my MCAD in school, but MCADs don't help in Rails!

Should I know about SVN, Mongrel, page caching and stuff because I don't know about those things. I've always deployed by hand to whatever was available on the server, I've created about 20 commercial web sites in the last year.

Is there anything else I should quickly learn about in the next day or so that wouldn't have been covered in all the blogs out there?

Hammertime
May 21, 2003
stop

Nolgthorn posted:

That's not true, I learned some about Microsoft SVN while I was getting my MCAD in school, but MCADs don't help in Rails!

Should I know about SVN, Mongrel, page caching and stuff because I don't know about those things. I've always deployed by hand to whatever was available on the server, I've created about 20 commercial web sites in the last year.

You should know about SVN, but you can learn this in 10 minutes. It's source control and it's drat easy/simple.

You should know what Mongrel is. A pure ruby web server perfect for development that can also be used in production if you spawn a handful of them and proxy to them.

You should read some basic caching tutorials, page/fragment etc.

Without really knowing the scope of your knowledge it's hard to recommend further topics, but most of the stuff is covered in blogs.

Edit:
- Read a good tutorial on eager loading

Hammertime fucked around with this message at 00:18 on Feb 5, 2008

drjrock_obgyn
Oct 11, 2003

once i started putting pebbles in her vagina, there was no going back

Nolgthorn posted:

Help!

I have a technical interview coming up for employment in a salary based role using Ruby on Rails. Up until now all of my professional work with Rails has been under contract and I've done or learned about only what I wanted to know.

I'm really nervous because I realize that -first of all- I want the job, but that I don't know dilly about what is expected when working with other programmers.

That's not true, I learned some about Microsoft SVN while I was getting my MCAD in school, but MCADs don't help in Rails!

Should I know about SVN, Mongrel, page caching and stuff because I don't know about those things. I've always deployed by hand to whatever was available on the server, I've created about 20 commercial web sites in the last year.

Is there anything else I should quickly learn about in the next day or so that wouldn't have been covered in all the blogs out there?
    If it were me, I'd read up on the following:
  • You will need to know SVN stuff at least. As another poster said, though, it's very easy to pick up.
  • Read everything on The Rails Way
  • Know what presenters are and when to use them.
  • Skinny controllers, fat models.
  • Become familiar with the different AR relationships and their uses (include polymorphic if you have the time).
  • You should have an idea of what Mongrel is and know that apache/nginx proxy out to your mongrel instances.
  • Be familiar with migrations.
  • Bonus: Memcache (cache-fu) and file uploads (attachment_fu).

skidooer
Aug 6, 2001

drjrock_obgyn posted:

If it were me, I'd read up on the following:
You forgot the most important one of them all: Unit/functional/integration tests.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.
I've encountered a bit of a problem with sending out emails to multiple recipients (a mailing list, not spam). Basically, from what I've read it can be done two ways.

#1
code:
  # Controller
  @list = Recipient.find(:all)
  Mailer.deliver_mailing(list, "some text from somewhere")

  # My ActionMailer instance
  def mailing(list, text)
    from "noreply@mydomain.com"
    subject "Mailing List"
    list.each do |recipient|
      bcc << recipient.email
    end
    body :text => text
    content_type "text/html"    
  end
#2
code:
  # Controller
  @list = Recipient.find(:all)
  @list.each do |recipient|
    Mailer.deliver_mailing(recipient, "some text from somewhere")
  end

  # My ActionMailer instance
  def mailing(recipient, text)
    recipient recipient.email
    from "noreply@mydomain.com"
    subject "Mailing List"
    body :text => text
    content_type "text/html"    
  end
From what I understand both methods have their pros and cons. I believe #1 to be faster, but the view is the same for every recipient. Conversely, #2 is going to be slower, but I could do stuff like add body :recipient => recipient and then in the view have access to stuff like <%= recipient.name %> if I wanted to address the mailout personally.

Is there any way to get the advantages of both?

Graphics
Jun 9, 2003

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.

Graphics fucked around with this message at 09:08 on Feb 14, 2008

Jayzer
Dec 16, 2003
Would love an invite.

edit: Got it, thanks!

Jayzer fucked around with this message at 03:53 on Feb 15, 2008

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.

Hop Pocket
Sep 23, 2003

There was a guy at the Atlanta ruby user's group last night that demo'd his site that is similar to this (http://mor.ph/), albeit not exactly the same.

Graphics
Jun 9, 2003

Jayzer posted:

Would love an invite.

jayzer /at/ gmail \dot\ com

Sent.

So we don't flood this thread with invite spam I should probably follow asveepay's example and ask anyone who is interested to PM me.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.
I know Hobo is mentioned in the first few posts but has anyone done anything with it since? I thought I'd have a go at rewriting an existing Rails app with it to add some functionality (users and permissions) and to fix some problems with the old app. The problem I'm facing now is there's, as far as I can see, no documentation whatsoever for recent iterations of DRYML. Does anyone know if there is any reference at all?

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

SeventySeven posted:

I know Hobo is mentioned in the first few posts but has anyone done anything with it since? I thought I'd have a go at rewriting an existing Rails app with it to add some functionality (users and permissions) and to fix some problems with the old app. The problem I'm facing now is there's, as far as I can see, no documentation whatsoever for recent iterations of DRYML. Does anyone know if there is any reference at all?

I am eagerly anticipating using datamapper in the future when it becomes compatible with Windows, so I hope that it is still under heavy development. My first impressions of merb about a month ago was that it was being heavily documented.

Are these two things not the case anymore?


Edit: Also I'm still waiting to hear back from the job I want, from earlier up on this page. I'll let you guys know how it goes, here's crossing my fingers!

MrSaturn
Sep 8, 2004

Go ahead, laugh. They all laugh at first...
I still use hobo a good bit, but the change to rails 2.0 kinda broke all of my applications, for one reason or another, so I had to start from scratch with a lot of things. I really need to set up subversion.

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
I am getting started with RoR 2.02 and am stuck...

I have no problem creating the models and such and a scaffold for each model, but is there a standard way for editing the stuff that is related?

For instance if I have a Category model and a Movie model.... How do I set it up to list the category that a movie belongs to and change it (with a dropdown), then show what movies are in a category?

I know how to do this using the model from the console, and I have the has_many and belongs_to things setup and working. However, since the new scaffold does not work with relationships, I am not sure of the best practices on how to tie this all together with the views and controllers and such (I am sure I could hack it together in some sort of lovely php-esque style though).


Also I would like categories to be a tree, but apparently acts_as_tree no longer works in 2.0. Any ideas?

derdewey
Dec 3, 2004
You need to add the foreign key using a migration, for your case you would add category_id (an integer) to the movies table. You'll find all the details at api.rubyonrails.org . After you've changed the table schema you can specify how the behaviors will work. You'll just say that a move 'belongs_to :category' and that the categories 'has_many :movies'.

After you've updated the models you'll have to edit the scaffolded code by hand. Which is usually what you do with scaffolded code, you generate it then start building off what's there.

I know you want the straight up answers but it sounds like you're giving rails too much credit. You still have some lifting to do. The api documentations will be really helpful.

Oh, and I think acts_as_tree is a plugin for 2.0. You'll have to do ./script/plugin install acts_as_tree (or somesuch).

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
Thank you for the info.

I do already have all the relationships and the migrations and such setup. I just wasn't sure if there was just some conventionalized way to setup editing relationships within the framework.

Typically I would just edit a movie, get a list of all the categories in a drop down, then you would select one. I think that is probably exactly what I need to do.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Nolgthorn posted:

Edit: Also I'm still waiting to hear back from the job I want, from earlier up on this page. I'll let you guys know how it goes, here's crossing my fingers!

I got the job, one question came up in the final interview of interest. If technology was today's, but my career was five years from now, then what do I see myself doing?

Sort of a slightly different take on the "Five years from now?" question, supposedly to eliminate some of the "I'd be using space programming!" answers, which was my first instinct.

Woo hoo!

evildoer
Sep 6, 2006
Is there a method to move up just one directory in Ruby?

Pardot
Jul 25, 2001




For those of you who rSpec, is there a good way to set expectations on #initialize? I was doing this, but it seems dirty:

code:
describe Clock do
describe "#initialize" do
  it "should start ticking"
    clock = Clock.new
    clock.should_receive :start_ticking
    clock.__send__ :initialize
  end
end
end

class Clock
  def initialize
    start_ticking
  end
  def start_ticking
    puts "tick"
  end
end
I've since just refactored out the initialize method, but there still seems like there should be a better way then to call initialize a second time.

evildoer posted:

Is there a method to move up just one directory in Ruby?

I'm not sure what exactly you want to do, but look at FileUtils maybe? Also if you're using ruby to do command line stuff, you should look at making Rakefiles.

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

Pardot posted:

...

When i do stuff like this I tend to do the following:

code:
Clock.create_new_ticking_clock

class Clock
   def self.create_new_ticking_clock
      Clock.new.start_ticking
   end
end
I find this easier to test and mock.

Pardot
Jul 25, 2001




Oh, I like that idea. I'll have to keep that in mind.

My class actually is an importer that uses some api. I was setting up an api connection in initialize, but I've since refactored it so that there's a method that makes the api connection only if there isn't already one. Then each method that needs a connection calls ensure_connection.

It also works well because I can stub that method so it doesn't actually go out and make the connection.

5TonsOfFlax
Aug 31, 2001
I made a ror webapp back in the 1.1.6 days, and that was a pretty rough learning experience. But the app itself is still going strong, so I wanted to do my next project in hobo. I have a couple of questions:
Do I have to update the old app to rails 2.0, or can I have two different apps on the same host run different versions?

I installed the latest instantrails and hobo today to see what I could do. Not much. Instantrails seems to have db set up to use sqllite by default, and when I try to use mysql, I get some dll errors. Then everything seems to connect anyway. What's with "The procedure entry point mysql_stmt_row_tell could not be located in the dynamic link library LIBMYSQL.dll"?

Hobo scaffolding seems to work, but the user stuff doesn't. "undefined method 'username'. This is in unchanged generated scaffold code.

Hobo also seems to need classic pagination, which is no longer included, and trying to install from svn://errtheblog.com/svn/plugins/classic_pagination does jack poo poo. No errors, no new files, just nothing.

What do I really need to do to get things to "just work" in the framework that's supposed to be so loving easy?

hmm yes
Dec 2, 2000
College Slice

5TonsOfFlax posted:

I made a ror webapp back in the 1.1.6 days, and that was a pretty rough learning experience. But the app itself is still going strong, so I wanted to do my next project in hobo. I have a couple of questions:
Do I have to update the old app to rails 2.0, or can I have two different apps on the same host run different versions?

I installed the latest instantrails and hobo today to see what I could do. Not much. Instantrails seems to have db set up to use sqllite by default, and when I try to use mysql, I get some dll errors. Then everything seems to connect anyway. What's with "The procedure entry point mysql_stmt_row_tell could not be located in the dynamic link library LIBMYSQL.dll"?

Hobo scaffolding seems to work, but the user stuff doesn't. "undefined method 'username'. This is in unchanged generated scaffold code.

Hobo also seems to need classic pagination, which is no longer included, and trying to install from svn://errtheblog.com/svn/plugins/classic_pagination does jack poo poo. No errors, no new files, just nothing.

What do I really need to do to get things to "just work" in the framework that's supposed to be so loving easy?

You can run multiple versions of rails on the same server without problems. If using the gem, check your environment.rb to see what gem version is required. You can install a specific version of a gem using the -v flag, I believe. You can also rake freeze your version of rails and then you don't need the gem to be installed. Freezing a gem will place it in /vendor of the rails project, and not require the actual gem to be installed on the server.

I thought instantrails was depricated? You're always going to be better off installing ruby + rubygems => gem install rails, and I suggest you try that instead of using Instantrails.

The MySQL errors: do you have the latest mysql gem installed?

I haven't used Hobo. I'd try their mailing list, though.

Hammertime
May 21, 2003
stop

atastypie posted:

You can run multiple versions of rails on the same server without problems. If using the gem, check your environment.rb to see what gem version is required. You can install a specific version of a gem using the -v flag, I believe. You can also rake freeze your version of rails and then you don't need the gem to be installed. Freezing a gem will place it in /vendor of the rails project, and not require the actual gem to be installed on the server.

I thought instantrails was depricated? You're always going to be better off installing ruby + rubygems => gem install rails, and I suggest you try that instead of using Instantrails.

The MySQL errors: do you have the latest mysql gem installed?

I haven't used Hobo. I'd try their mailing list, though.

Just to complicate things ...

In my opinion you're better off just using the latest version of the InstantRails package. Having an additional stack of apache/php/phpmyadmin can be really helpful for mysql administration (if you cant be bothered to install the desktop clients).

InstantRails is far from deprecated. It was temporarily deprecated for a few weeks, but was revived and now comes bundled with Rails 2.0.2 and the latest versions of everything else.

I'm happily using InstantRails at work and home for my commercial development until the new revision of the macbook pro comes out.

Doing things manually from rubygems also isn't a bad idea though, but there's nothing wrong with InstantRails.

5TonsOfFlax
Aug 31, 2001
Still don't know what's going on with the mysql thing, but it appears to be a harmless (but annoying) error. I can live with that.

I think the user thing was because I was trying to use an existing db with a user table instead of letting hobo create one. I guess I'll have to follow the hobo way.

And I got classic_pagination installed just now, but I don't know if it makes the error go away. The problem was apparently with the version of svn in my cygwin install. Re-installed cygwin with svn and suddenly the plugin install did something. An error message on the original failure would have been nice.

Also, anyone know how hobo plays with will_paginate since apparently classic_pagination is stinky and unloved now?

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.
Ruby automatically promotes a Fixnum to a Bignum when the value is too large to be held in a Fixnum. This is very sweet of it, but is also a gigantic pain in the rear end when you're doing bitwise operations where you want bits to fall on the floor. Is there any way to disable this, so that you can do normal integer-based bitwise operations?

derdewey
Dec 3, 2004
Just a thought, how about testing the object with object.kind_of?(Bignum) or object.kind_of(Fixnum)? That way you know what bitmask to use. But ya, I think ruby's magical transformations can get in the way when you're doing something 'fancy'.

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

derdewey posted:

Just a thought, how about testing the object with object.kind_of?(Bignum) or object.kind_of(Fixnum)? That way you know what bitmask to use. But ya, I think ruby's magical transformations can get in the way when you're doing something 'fancy'.

Well, all that I'm trying to do is implement the Jenkins one-at-a-time hashing algorithm. It's a very simple algorithm (here's how it would work if auto-conversion was disabled):

code:
   key.to_s.each_byte{ |b|
      hash += b.to_i
      hash += (hash << 10)
      hash ^= (hash >> 6)
   }

   hash += (hash << 3)
   hash ^= (hash >> 11)
   hash += (hash << 15)
Obviously it's the left-shifts that are making my puny regular integer into a super-integer.

If I could just xor the top-half of the Bignum with itself, that would work. But I'm not quite sure how I would go about doing that.

Unixmonkey
Jul 3, 2002

Begby posted:

Thank you for the info.

I do already have all the relationships and the migrations and such setup. I just wasn't sure if there was just some conventionalized way to setup editing relationships within the framework.

Typically I would just edit a movie, get a list of all the categories in a drop down, then you would select one. I think that is probably exactly what I need to do.

Check out James Golick's Attribute_fu, or at least watch Ryan Bates' screencasts on multi-model forms.

http://jamesgolick.com/attribute_fu
http://railscasts.com/episodes/73

In fact, do both, but in reverse order. You'll get a better idea of what's going on in the background.

freeb0rn
Jan 22, 2005
Does anyone know if I can figure out within an action (in a controller) if the action has been called "remotely" (all AJAX-like) or not? Apart from sending some sort of special parameter when you update remotely and figuring it out on your own, that is.

EDIT:
Apparently this is done by inspecting the Accept header and using respond_to, which is what I thought but hadn't figured out how, exactly.
This little excerpt I found sheds some more light on the situation:

quote:

If an old browser submits this form, we'll have it done through a plain old POST, which the browser sends along with a header like "Accept: */*". That means "I don't care what kind of response you give me, just give me something". Since the browser doesn't care, we'll decide what to do on the order of the type declarations. The first is type.html, so that's what we'll perform, which in this case simply instructs the browser to go back to the index.

If an Ajax-capable browser submits this form, Prototype will intercept the submission and turn it into an Ajax call. This call will be send along with "Accept: text/javascript, text/html, application/xml, text/xml */*", which specifies a preference order where Javascript is first, if not available, then HTML, if not, then XML, and finally it'll accept whatever if none of the preferred forms are available.
http://ajaxian.com/archives/using-the-http-accept-header-for-ajax

freeb0rn fucked around with this message at 06:54 on Feb 28, 2008

Hop Pocket
Sep 23, 2003

freeb0rn posted:

Does anyone know if I can figure out within an action (in a controller) if the action has been called "remotely" (all AJAX-like) or not? Apart from sending some sort of special parameter when you update remotely and figuring it out on your own, that is.

EDIT:
Apparently this is done by inspecting the Accept header and using respond_to, which is what I thought but hadn't figured out how, exactly.
This little excerpt I found sheds some more light on the situation:

In your controller:

code:
def create_something
  if request.xhr?
    # the request was made using some sort of ajax black magic.
  end
end

Sewer Adventure
Aug 25, 2004
Any way to get rails to handle concurrent connections?

Hop Pocket
Sep 23, 2003

Sewer Adventure posted:

Any way to get rails to handle concurrent connections?

Rails is single-threaded, so I don't believe you'll be able to do that. In production, a common solution is to simply have a pack of mongrel processes that traffic gets proxied to by an Apache load balancer.

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

Hop Pocket posted:

Rails is single-threaded, so I don't believe you'll be able to do that. In production, a common solution is to simply have a pack of mongrel processes that traffic gets proxied to by an Apache load balancer.

I use nginx and thin. Works very well.

http://www.rubyinside.com/thin-a-ruby-http-daemon-thats-faster-than-mongrel-688.html
http://code.macournoyer.com/thin/
http://wiki.codemongers.com/Main

skidooer
Aug 6, 2001

Hop Pocket posted:

In your controller:

code:
def create_something
  if request.xhr?
    # the request was made using some sort of ajax black magic.
  end
end
Depending on what he is trying to do, respond_to is probably better suited for this job.
code:
def new
  @object = Object.new

  respond_to do |type|
    type.html do
      # Do your regular request specific stuff here
    end

    type.js do
      # Do your AJAX specific stuff here
    end

    type.xml { render :xml => @object.to_xml } # We'll do some XML for fun as well
  end
end

freeb0rn
Jan 22, 2005
Yeah I'm using that second approach.

LOLLERZ
Dec 9, 2003
ASK ME ABOUT SPAMMING THE REPORT FORUM TO PROTECT ~MY WIFE'S~ OKCUPID PERSONALS ANALYSIS SA-MART THREAD. DO IT. ALL THE TIME. CONSTANTLY. IF SHE DOESN'T HAVE THE THREAD, SHE'LL WANT TO TALK TO ME!

Unixmonkey posted:

railscasts
I just watched a bunch of those and I seriously can't recommend this site enough.

Other screencasts I've seen at 15 minute affairs where you can't even remember the beginning by the time they get to the end, and they try to cover too many topics at once.

These are almost like video documentation for how to do typical tasks in Rails.

Adbot
ADBOT LOVES YOU

Hop Pocket
Sep 23, 2003

freeb0rn posted:

Yeah I'm using that second approach.

I will be too in the future. A much better way of doing it, I now see. Thanks guys.

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