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
Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Walrus791 posted:

Whats everyone using as a Rails IDE? I just installed Apanta/RadRails for Eclipse and its looking very convenient, if a little shallow. Still more then SciTE/Notepad++, but still, a nice IDE goes a long ways.
Rails is a very dynamic language that's mostly impossible to do any kind of static analysis on, so I'm still torn on what the actual benefit of an IDE is for Ruby/Rails other than maybe basic integration with a revision control system. I just use syntax-highlighting editors for the most part: Programmer's Notepad 2 on Windows and Kate/vim on Linux. It's not exactly difficult running the script/generate stuff or script/server mongrel from the command line.

RadRails is pretty cool, but it's crashed on me five or six times in a week before, and I can't say I've ever had that problem with a regular text editor. Considering RadRails adds little value besides loving up my indentation when I'm trying to code, and sticking in end tags where I don't want them, I decided to pass.

I should also note that the multi-monitor support in Eclipse is absolutely awful.

Vulture Culture fucked around with this message at 14:07 on Aug 9, 2007

Adbot
ADBOT LOVES YOU

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Mr. Wynand posted:

It also doesn't have to be Rails you start with. ... Perl
This was my first language and dear loving God do not do this

you will never fix all the damage

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Austria posted:

Hosts that oversell cannot guarantee you the bandwidth they advertise. It's usually all in their ToC (you really think they have 1 million TB available for every user?). If you're after storage, I suggest looking into Amazon's S3. Even their EC2 stuff is nice if you're after hosting.
As long as they abide by the terms of your hosting and don't try to cancel your account for letting you use your allotted bandwidth, though, it's not really an issue. Banks don't really have all the money that's invested in them either.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

atastypie posted:

So an application that was getting heavy use today started throwing out a bunch of:

NoMethodError (undefined method `[]' for nil:NilClass):

On random places. I've never had these before, and generally the actions that would spit out the error would work fine if you just tried it again. Is this something that can be attributed to low memory? I've killed some other processes just in case. If this is low memory, what are some of the basic things I can do to optimize (in rails) and keep an eye on utilization (in linux)?

Edit: I'm also only running a single mongrel instance. Does it need to be two or more?
This usually happens when you have a parse error somewhere, someplace in your code. They're a total bitch to track down.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Nolgthorn posted:

Why is it important to maintain any semblance of plugin backwards-compatibility? Generally if you're developing a Rails application, you use the latest version and go to production when it's done using whatever version you started with, unless there is a feature you absolutely need you wouldn't update it.

I would imagine there is a lot of code that could be different or that is different in Merb, why keep all these old methods? Isn't that all the opposite of trimming down the bloat Rails has been accumulating and the opposite of making it run faster?

Edit: Ohhh they're just talking about a public API for plugin functionality... ok I guess.

I really hope they bring Merb's slices.
That's fine for applications that have active maintainers. For applications that don't, and need to stay in lock-step with security updates to the platform, breaking everything possible on a new release is kind of nightmarish for system administrators, who might have the good sense and Ruby knowledge to migrate small apps to the new framework, but have no interest in completely rewriting all plugin-provided functionality. Rails doesn't exactly have the best track record of backporting security fixes to prior releases once a new one is out.

Vulture Culture fucked around with this message at 21:18 on Dec 27, 2008

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Pardot posted:

At the very least use https. As a first pass that probably also has security holes, I'd have the app store an api key that is used for authentication. On first use of the ios app, it would see that it doesn't have one and request one from your server, 'creating an account' as it were at that point.
What happens if the device is wiped and loses its API key? You would need a transparent way to reset or redownload the key, which brings you back to square one if you're not using any other authentication factors.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.
Does anyone have fixtures working with multiple databases? My models, migrations and tests are working great with DbCharmer, but I can't figure out how to pull my fixture data in properly. I'd rather not use a factory/AR-based method of populating my tables, since it's a lot slower than I'd like. Halp?

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.
Question #2: When using single-table inheritance, what's the simplest way of shoving all the derived models into a namespace in such a way that ActiveRecord will actually pick them up?

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Kallikrates posted:

STI in rails is setup at the model layer. All you need is a type column on the base class, and that your child model classes actually inherit from the base class (which will inherit from active record).
Right, and that works great with models in the global namespace or in the same namespace as the parent model class. But let's say I have something like this for DNS records in PowerDNS:

Record
Record::A
Record::CNAME
Record::TXT
...


Each of these has the exact same fields, but I'd like to use different model validations for each record type.

With AR's default behavior, I need top-level classes like:

Record
A
CNAME
TXT
...


or it won't work, because AR doesn't know to prefix the class by default.

Is it possible to get it to look in the Record namespace automatically when the Record automatically becomes() a subtype on instantiation? The schema of PowerDNS is such that I'm not able to store the fully-qualified class name in the DB (and I wouldn't want to anyway).

Vulture Culture fucked around with this message at 21:57 on Apr 12, 2013

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

MariusMcG posted:

Is this thread appropriate for Ruby questions that aren't focused on Rails?

If so: I'm new to Ruby, and as a learning project I'd like to do something with Rack. Ruby seems to have a nice ecosystem for infrastructure-as-code, but I'm not sure what is the most commonly-used web server configuration for folks using Rack but not Rails. Do folks usually start up servers using Thin and then tie them in to nginx using sockets, or...? I'm curious what most folks do (assuming they're self-hosting, or at least not using Heroku).
There's lots of Rack-based frameworks out there in wide use, particularly Sinatra, but the whole idea of Rack in the first place is that it's supposed to make deployment methodologies for "Rails" versus "not Rails" irrelevant. Infrastructure-as-code also isn't of any particular importance or relevance to the question you're asking.

If your core question is "how should I host my Rack application?" your first answer should be "whatever's easiest" and your second answer should be "whatever will help scale my app to where it needs to be" after the the first answer stops being good enough. Thin and Unicorn are the two most popular Rack servers these days, and the dichotomy generally breaks down as follows: if you want something that's really easy to get working, use Thin, and if you need to squeeze every drop of performance out of your application, use (and hand-tune) Unicorn. Passenger is still a good option if you have some application that mostly sits idle and can be spun up on demand the first time a user hits it.

For internal applications where you're not dealing with high request throughput, if you wanted to keep configurations really simple you could probably get away with just running the app server and not front-ending it with something like Nginx at all. A frontend web server will give you the following benefits, though:

  1. Caching, significantly faster asset serving
  2. A more feature-complete HTTP implementation (easily set custom headers, etc.)
  3. Useful log formats
  4. Much more flexibility in configuration (URL rewrites and so forth)
  5. Thin and Unicorn aren't going to do SSL for you

You have the option of using Unix sockets or proxying to the app server over TCP. In synthetic benchmarks, Unix sockets are faster, but in practice, the performance difference is generally negligible unless you're operating at insane scale.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

raej posted:

In reference to my cellar list above. How would I go about destroying a Cellared_Beer with the correct variables (size, year) when this is being viewed in the User model?

For instance, the view attached is users/1/cellar

I need the "delete" link to destroy a cellared_beer (which has user_id, beer_id, size, year, created_at, updated_at) that matches that line item (unique on beer_id, size, year)


Using the approach you've chosen, you're overcomplicating things and making your schema really difficult to work with -- if you decide to modify your constraints anywhere in the system, you have lots of things you need to update because of the incredibly tight coupling you've chosen. If I were you, I'd create a single numeric primary key for each combination of (beer_id, size, year) and use simple unique constraints instead of a compound primary key to ensure uniqueness properly.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

xtal posted:

Coming back to Rails development and I see that unicorn is included in the default Gemfile now. Is that the preferred web server or do people still use Thin / Passenger?
Unicorn is the fastest option for most applications, but it's complex and it needs a good amount of hand-holding to get the performance options right. Thin is still a good option if you want something that will work reasonably well for most apps out of the box. There's lots of newer servers like Puma, adding more confusion.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Smol posted:

So a lot of you guys probably use apache or nginx on a relatively up-to-date distro. If you're using TLS as well, you better upgrade your packages, because a pretty big hole was found from openssl 1.0.1.

http://www.openssl.org/news/secadv_20140407.txt

Here's an online tool that you can use to see if you're vulnerable:

http://filippo.io/Heartbleed/

Short checklist if you were affected (by no means comprehensive):

- Update your system and make sure you're not vulnerable any more
- Get new certificates
- Regenerate a new Rails session secret to invalidate existing user sessions
- Change any passwords or other potentially compromising information that might've passed through apache/nginx.

On a side note, being still on RHEL 6 or Debian 6 mostly saved our asses at work. :sweatdrop:
Do note that RHEL 6.5 is vulnerable (though prior versions are not).

Adbot
ADBOT LOVES YOU

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

KoRMaK posted:

Cool this looks good.

I think I can pull something off with jasmine too. I can conceivably enter the tests via the chrome console as a client and be able to watch most of the stuff I need I think, like events and data input.

I might give jasmine a try first and see how good or bad that goes and then fallback to selenium. Thanks for the tip.
You'll probably find DalekJS a lot simpler than Selenium, for what it's worth.

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