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
vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

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.

I just use Textmate and have autotest, mongrel, and script/console open in different terminals as I develop. More window clutter but I never got into Eclipse/Radrails.

Adbot
ADBOT LOVES YOU

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

Roloc posted:

The IIS one seems like a huge PITA which concerns me. Not that I am a huge fan of IIS but some of my clients are, anyone know a better way?
The simple answer is don't use Rails on Windows in production. It really really sucks and very few people are doing anything about it.

That said I have a Rails app in production on a Windows server (internal app for the company I work for). I have Apache on the front proxying to mongrel for this one app, and proxying to IIS for the other apps on the server. It's not pretty but it works and the app gets low traffic so performance isn't really an issue.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

Nolgthorn posted:


On a traffic heavy web site this log file will eventually get really big right? Isn't that bad? Regardless I want to turn it off.
environment.rb or production.rb
code:
ActiveSupport::Deprecation.silenced = true
more info: http://ryandaigle.com/articles/2006/12/04/how-to-turn-deprecation-warnings-off-in-rails

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

Fork posted:


You do know you can use ActiveRecord inside your migrations to do data manipulation/sanizations between migrations?
Yeah but when you try to re-migrate from scratch, you're using [latest model] versus [older database migration] that may not be compatible anymore. He said this himself in his post.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

MrSaturn posted:

Speaking of all this migration business, how can I use rake db:migrate to just... add a field to a table? I'm still heavily developing my application, and I often find the need to add columns (as I develop features), and I don't want to have to wipe the contents of my db each time. Often rake db:migrate doesn't seem to do anything.

code:
class Whatever < ActiveRecord::Migration
  add_column 'table', 'column', :datatype
end

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

MrSaturn posted:

Ah, thanks!

Whoops, be sure to put that in the self.up method :shobon:

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

skidooer posted:

I fail to see how one library can ruin another. ActiveRecord is not a required dependency. You can use whatever persistence layer you want.

And is Og any better? Are there any other ORMs for Ruby besides those two?

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

atastypie posted:

Hobo is brand new, so there is very little up to date documentation let alone an entire book. You could print off the docs from the website and reference those instead.

I have a problem that I am sure is actually really simple: I want to add up and return a total price across a m2m association. Using the generic example, I want to be able to add up the total price of all Books based on an Author.

Author
habtm :books

Book
habtm :authors
t.column "price", :integer

Can anyone help me out?
code:
@author = Author.find(params[:author_id])
@total_price = @author.books.inject { |sum, book| sum + book.price }

There's probably a better way to do this that doesn't involve so many behind-the-scenes DB calls but I can't think of it right now...

vg8000 fucked around with this message at 13:26 on Aug 23, 2007

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

cYp posted:

I'm either going to get started learning PHP or Ruby on rails. I'm currently leaning towards php. Will this be a mistake in the future?
PHP is probably the worst language to start with. It's got widespread support, but there's so much cruft that comes from not being very well designed in the first place. Go with Ruby or Python.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

crazysim posted:

Many books have multiple authors. There are so many real world examples on this that I don't even know where to start with an example. I'm just a newbie, but habtm on first glance would make sense to me on that.

There's also has_many :through, which can let you flesh out the relationship a more than a habtm can.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

scr0llwheel posted:

So I'm thinking of starting a project with RoR but have one question: Is there a suitable way to do user registration, authentication, etc? Granted, I haven't looked into it very much, but all authentication stuff seems to be either the entire site or nothing. What I'd specifically like to do is to protect an admin control panel along with admin-only elements/controls on an otherwise publicly viewable page.

Is this built into RoR and I just missed it? Are there any gems available to do this? How hard is this to implement?

There's a plugin called restful_authentication that's pretty much the standard if you're not going to write something custom. It'll give you all the username/password/login/session stuff, and you can build from that.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

shopvac4christ posted:

How would one deploy a common library to all sites on a server? I ask the question this way because I'm coming from ASP.NET, where if we updated something in a global utilities library, we could just copy the DLL to separate projects, or even better, import it server-wide. I'm guessing it has something to do with plugins and maybe using capistrano to update the plugins for each site in a special deployment, but beyond that I wouldn't have any ideas.

Either the same plugin copied to each site, or if possible build a gem and install that on the system for all the apps to use.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

brb buddy posted:

I really don't care about using REST, as I don't even really know (or care to know at this point) what it is. I just want a simple way to authenticate multiple users, and restful_authentication does this with a method (logged_in? I believe it is). So basically I call that method and that's my security check. It's also got e-mail account activation, and it's scalable. I want a plugin to do that, if not I'll have to waste a lot of time learning how Rails handles cookies and sessions, and while that seems like an interesting future project I'd prefer if the user system would just work now.
What version of rails are you using? Recent versions of restful_authentication have been geared towards working with Edge Rails/Rails 2.0 and not the current stable version, so that might be why you're having so much trouble. I don't know, I haven't used newer versions of restful_authentication.

brb buddy posted:

And Railscasts sucks, making it seem like it's easy as pie to get this plugin to work...It's not, the plugin doesn't loving work as intended.
See above, Rails moves so fast that what worked perfectly 6 months ago may be deprecated and abandoned today.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

roop posted:

Does anyone have a sample application that implements a one-to-many and has views that allow them to be created at once? Should I be combining the two above into one Model? Or should they be two separate models with a single controller?
Keep the two models, use one controller. Here's a tutorial that explains how to do what you're asking.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

MrSaturn posted:

does it go as /public/info.rhtml
or
/public/info/index.rhtml?

I'm not really getting either to work.

/public/contact.html

The URL for this should end up like this: http://example.com/contact.html

If you wanted some dynamic stuff on the page you'll have to make a new controller/view.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

Hammertime posted:


I find the generators in ruby just make it more awkward to add all the new files to subversion. If only there was some magical versioning solution.
:confused:
code:
./script/generate scaffold_resource Whatever name:string --svn
This will add your generated files into SVN automatically.

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

atastypie posted:

I find my helpers are generally empty, with things like this going in my model:

code:
def full_name
   self.first_name + " " + self.last_name
end
Is this something that should be a helper? What is the rule of thumb for whether something should go in the helper instead of the model?

I tend to do the same thing.

Adbot
ADBOT LOVES YOU

vg8000
Feb 6, 2003

You never question Heylia's eyeballing. That's the rainman of weed right there.

MrSaturn posted:

I'm very suddenly having a very odd problem. I'm running instant rails on vista, and as of last night, I can't start up mySql because
code:
---------------------------
MySQL
---------------------------
Either Apache or MySQL cannot run because another program is using it's port.
---------------------------
OK   
---------------------------
how do I figure out what port is being blocked, what's blocking it, and how to change that in mySQl or the other program?

Mysql's port is 3306, Apache's is 80 (unless you changed the ports they listen on). You might have another web server running on port 80 or something, check that first.

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