|
Leaving in one minute but I don't know if that will even work, since you got to method_missing through a render with a missing template (explicit or implicit) so you'll get a double render error when you get that far. I think. You probably want to look at rescue_action_in_public
|
# ? Apr 10, 2009 16:05 |
|
|
# ? May 15, 2024 23:03 |
|
NotShadowStar posted:Leaving in one minute but I don't know if that will even work, since you got to method_missing through a render with a missing template (explicit or implicit) so you'll get a double render error when you get that far. I think. You probably want to look at rescue_action_in_public Cool. I just changed the code to code:
|
# ? Apr 10, 2009 16:10 |
|
Okay, even better, Rails now has a rescue_from construction. Provide rescue_from with an exception class and you can invoke a method to handle that. Don't raise exceptions in the other methods though or you could be caught in a loop. These are the end of the chain. Also remember that 404s and 500s are handled differently in production and development environments. Remember to switch your env to production to test and make sure it works the same. code:
|
# ? Apr 10, 2009 18:05 |
|
Lamont Cranston posted:I'm trying to implement custom 404 pages using method_missing in my ApplicationController. This code: Why not just: code:
|
# ? Apr 12, 2009 19:20 |
|
Lamont Cranston posted:I'm trying to implement custom 404 pages using method_missing in my ApplicationController. This code: Use routing instead. Put this as the last route: code:
|
# ? Apr 14, 2009 03:30 |
|
Just starting out with this and my end goal is to get a web gui with my oracle db and thought I'd give rails a try to see how easy it is. So far, I've managed to get everything installed and got the connections to the db working fine. All the tutorials I've found so far want me to use scaffold and then migrate. What I'd trying to do is get this working with an existing table with data already in it, so I don't want to make something new. I've tried just doing a scaffold based off an existing table but figured out that's not the way to do it. Is there a tutorial out there that shows what I want to do or am I missing something obvious? edit: Or I'm just going in the completely wrong direction with this. chemosh6969 fucked around with this message at 19:37 on Apr 16, 2009 |
# ? Apr 16, 2009 19:29 |
|
No need to make any migrations if the tables are pre-existing, models will automatically be filled with data based on the contents of the fields. If you have a table called users then run "script/generate model user" and delete the migration file from db/migrations. Then if you type script/console and then enter User.first it should return the first user from your database
|
# ? Apr 16, 2009 19:55 |
|
That got me closer. I did script/generate model YEAR1, but when I tried to pull the first record it died from trying to pull it from table YEAR1s
|
# ? Apr 16, 2009 20:06 |
|
Oh god yes: http://weblog.rubyonrails.org/2009/4/16/phusion-announces-passenger-for-nginx
|
# ? Apr 16, 2009 20:20 |
|
Has anyone used hpricot or similar to screen scrape pages that are heavy on ajax/javascript? Right now all I am getting returned is the ol 'your browser needs to support javascript' message when I try to pull down a page.
|
# ? Apr 16, 2009 20:27 |
|
chemosh6969 posted:That got me closer. I did script/generate model YEAR1, but when I tried to pull the first record it died from trying to pull it from table YEAR1s Use ActiveRecord without Rails first, just connect using AR and figure out what you need to do from there, then take that knowledge back into Rails. I learned AR way before I touched a Rails app, it helps. atastypie posted:Has anyone used hpricot or similar to screen scrape pages that are heavy on ajax/javascript? Right now all I am getting returned is the ol 'your browser needs to support javascript' message when I try to pull down a page. Try WWW:Mechanize instead. I use it to interact with a javascript-based login integration site, but I didn't want to redirect to it so I wrapped in in a class that uses Mechanize instead.
|
# ? Apr 16, 2009 20:45 |
|
chemosh6969 posted:That got me closer. I did script/generate model YEAR1, but when I tried to pull the first record it died from trying to pull it from table YEAR1s The problem here is that Rails is heavy on convention over configuration. In other words, it assumes that if a model is named Office, the table in the database will be named offices. Of course this is less useful for existing databases but not hard to work around. You can still generate a model called Year1 -- but you'll have to add a line to the year1.rb file: set_table_name "year1" See http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002231
|
# ? Apr 18, 2009 15:09 |
|
Evil Trout posted:The problem here is that Rails is heavy on convention over configuration. In other words, it assumes that if a model is named Office, the table in the database will be named offices. Thanks for the info. Now I just hope I don't run into anymore problems from it assuming things that end up being wrong.
|
# ? Apr 20, 2009 17:03 |
|
I'm trying to learn Ruby--coming from Perl--and I decided that there would be no better way than to attempt a weird project from scratch in a new language. So, here I am. I'm trying to create a data warehouse with the bulk of the data being searchable from a web interface. What I've done so far is at: http://github.com/aitrus/usrsys/tree/master Before I try to explain myself, my goals are: 1.) Place account/group data from various operating systems / servers into tables 2.) Place associations from HR to those accounts into tables 3.) Use this data to report on user accounts (searching) and to track *new* changes to system accounts/groups as they happen, day-to-day. The database I'm building has a lot of purposes. In fact, I built it differently some time ago--with the purpose of performing system cleanup. I did it with SQLite and the tables were more visual (ie, Separate UNIX table for end-user accounts, application accounts, and "unknown" accounts; repeat for each OS). But that's not good design for legitimate databases. So, I decided to pursue this with Ruby (because co-workers love the poo poo out of it) because my web programming knowledge was stuck in 1998. I'm using "acts_as_revisable" so I can track changes across various entries / attributes. This is desirable, because engineering groups decide to make chnages to production accounts without following procedures. I feel for them (100%) but we're the ones who get in trouble when they gently caress up. So they don't get to do that anymore. My biggest issue now is with the design of how I present this information. I know how I want it to look. In fact, I can write the webpage and hard code column names (etc) and make it work all peachy. But that's not what I want. I want to keep the administration of this system simple (after I make this prod-worthy). I would really like to keep people out of dealing with programming issues--or make the administration of that a GUI (web) interface. Also, lots of AJAX APIs do a lot of work behind the scenes that saves me a lot of trouble. Sorta. ActiveScaffold is neat if I don't actually want to do anything with it. If I could somehow tweak what I've done with it--so far--to improve searching and other (sorta basic) options....... I'd be so much happier.
|
# ? Apr 23, 2009 09:13 |
|
Hello RoR experts! I'm currently doing a advertising/marketing internship for an internet start-up company- last night my boss told me he wants me to get a basic grasp of RoR to run some scripts, specifically for Twitter (we have a lot of active followers there since this is a resume posting website). He has the script and it's mainly going to be a copy paste (?) but he wants me to do start by doing, what I guess is the standard first application- "Hello, World". Only problem is I have zero knowledge on how any of this works. I've never used the Terminal on my mac before and each walkthrough I've tried to slowly go through has left me with nothing to show for it. I've been at it all morning, and after reading CoC I've decided that when I teach myself a programming language this summer, it will be Python. haha... Ok so back to my question. Can someone give me a supernewb guide to Hello, World?
|
# ? Apr 23, 2009 21:45 |
|
http://guides.rubyonrails.org/getting_started.html is what I'd recommend at this point. If you need something more realtime than a forum for help, jump into IRC and ask if anyone can help you with sticking points.
|
# ? Apr 24, 2009 00:41 |
|
If you've never done any web development ever, Rails is going to be really painful to learn and you're going to make a terrible app. Keep this in mind.
|
# ? Apr 24, 2009 02:51 |
|
Actually, wait. Running scripts and RoR don't go together very well at all because that's not what RoR is really for. What exactly does he want you to do, and are you sure he wasn't just asking you to do it in Ruby?
|
# ? Apr 24, 2009 03:07 |
|
Yeah I noticed that when I was researching rails this morning- this is for building apps, not running scripts. I just talked to him about it over dinner and he said it was for sure RoR and it's pretty much copy/pasting a script to automate Twitter. What exactly does it do? No idea.
|
# ? Apr 24, 2009 04:04 |
|
Here is a twitter gem. It looks like it supports oauth, and it's had recent updates. I haven't used it, but I'd check this out out first: jnunemaker-twitter
|
# ? Apr 24, 2009 04:25 |
|
Pardot posted:Here is a twitter gem. It looks like it supports oauth, and it's had recent updates. I haven't used it, but I'd check this out out first: jnunemaker-twitter I used this to make a really lovely desktop wxRuby twitter client. It works well enough.
|
# ? Apr 24, 2009 17:45 |
|
theEZkill posted:Yeah I noticed that when I was researching rails this morning- this is for building apps, not running scripts. I just talked to him about it over dinner and he said it was for sure RoR and it's pretty much copy/pasting a script to automate Twitter. What exactly does it do? No idea. You can have a Ruby script that doesn't use Rails, and call it from the command line.
|
# ? Apr 25, 2009 17:31 |
|
I'm really new to rails, so please don't take it too hard on me if I'm trying to do something really dumb. Is there any way to have my rails installation on my computer (using rake db:migrate) do operations on my webserver's mysql database? I have the database.yaml file set up that the host is the address of my server's mysql installation along with the username and password and everything, but when I try to use rake db:migrate on my machine the error it gives me uses my IP and not that of the servers. Is there a configuration file somewhere that I'm missing? Or am I doing this a completely backwards way?
|
# ? Apr 26, 2009 05:33 |
|
Oh my god, why doesn't Hobo support rails 2.3.2? I'm going to shoot myself in the head.
|
# ? Apr 27, 2009 03:40 |
|
Adolf Hitler posted:Oh my god, why doesn't Hobo support rails 2.3.2? I'm going to shoot myself in the head. Have you looked into its bleeding edge? According to their blog, they're prepping for a 1.0 release that might scratch your 2.3.2 itch.
|
# ? Apr 27, 2009 07:16 |
|
Bathroompants posted:I'm really new to rails, so please don't take it too hard on me if I'm trying to do something really dumb. This is probably not the best way to do this. The usual method of working with rails is to do all development locally on your machine, using a local database like sqlite, and then have your production server access its own database, usually something more robust like mysql or postgres. If you really need to use a remote db (e.g. if you really can't host the site on a rails capable server or you have a seperate db server) you can use the host and port parameters like so: code:
|
# ? Apr 27, 2009 13:12 |
|
deleted
Versus Boredom fucked around with this message at 01:09 on Apr 30, 2009 |
# ? Apr 27, 2009 23:27 |
|
What do you need to tackle? Installing ruby? Installing the gems? Using the script? Maybe if you take this to the general questions thread you'd have more luck.
|
# ? Apr 27, 2009 23:39 |
|
dustgun posted:What do you need to tackle? Installing ruby? Installing the gems? Using the script? Pretty much all of that- aside from Installing ruby. General question thread a better place?
|
# ? Apr 28, 2009 00:35 |
|
Bathroompants posted:I'm really new to rails, so please don't take it too hard on me if I'm trying to do something really dumb. If you're just running migrations (rake db:migrate) then you can do this to the production environment, which I assume is your webserver's database, by doing "rake db:migrate RAILS_ENV=production". This will run any migrations on your local computer but connect to the production database. Edit: Just realized that might be confusing. Your database.yml file probably has 3 different environments in it, production, test, and development. Development is probably set to your local machine, and rake will use development by default unless you tell it not to. wunderbread384 fucked around with this message at 02:30 on Apr 28, 2009 |
# ? Apr 28, 2009 00:42 |
|
Adolf Hitler posted:Oh my god, why doesn't Hobo support rails 2.3.2? I'm going to shoot myself in the head. I just started using Hobo too and I am going to shoot myself in the head trying to figure out DRYML.
|
# ? Apr 28, 2009 02:31 |
|
What rails hosting providers would you recommend? I am looking for something under $30/month if possible. http://www.hostingrails.com/ sounds good. Any experience with them? KarmaticStylee fucked around with this message at 04:03 on Apr 28, 2009 |
# ? Apr 28, 2009 04:01 |
|
KarmaticStylee posted:What rails hosting providers would you recommend? I am looking for something under $30/month if possible. I've been using Slicehost ($20 for an Ubuntu VPS with 256MB ram, enough to run a Rails site with light to moderate traffic), and it's a great value if you don't mind getting your hands dirty with a bare Linux box. Although with Rails Machine's Moonshine plugin (installs Ruby, Apache, Passenger, MySQL, and your gems, and sets it all up for you), you really don't have to do much other than secure your box. Also that's a referral link up above so you can go to http://slicehost.com if you're a commie pinko who hates capitalism Jargon fucked around with this message at 04:48 on Apr 28, 2009 |
# ? Apr 28, 2009 04:38 |
|
theEZkill posted:Hey guys- thanks for the advice. I just got that twitter script. Like I said before I'm a complete newb at this and care barley pull off a "Hello World". Yeah try and figure out what the gently caress is going on. Why is Mechanize needed for a Twitter app? Also what you have going on looks far more convoluted that what it should be. What is this Ruby program, can you show some of it or something? This smells of something designed by someone who used to be a Java person and is making things way way way overcomplicated.
|
# ? Apr 28, 2009 04:52 |
|
KarmaticStylee posted:What rails hosting providers would you recommend? I am looking for something under $30/month if possible. Slicehost for sure. There are a lot of guides out there on how to get up and running with them, and really part of the Rails experience involves figuring out how to set it up. Luckily for you it's gotten a hell of a lot easier over the past few years. I don't miss configuring dispatch.fcgi one bit.
|
# ? Apr 28, 2009 20:30 |
|
NotShadowStar posted:Why is Mechanize needed for a Twitter app? It probably actually logs into Twitter rather than using the API.
|
# ? Apr 28, 2009 20:31 |
|
Okay, so if I went with slicehost and used it to develop apps for clients... then they needed an affordable host.. how could I easily move my app to something affordable? (i.e. closer to godaddy pricing) edit: nevermind.. I could host it myself I guess.. wasn't thinking KarmaticStylee fucked around with this message at 22:19 on Apr 28, 2009 |
# ? Apr 28, 2009 22:10 |
|
KarmaticStylee posted:Okay, so if I went with slicehost and used it to develop apps for clients... then they needed an affordable host.. how could I easily move my app to something affordable? (i.e. closer to godaddy pricing) If you have multiple clients with low-to-medium traffic websites, you can spend $38 or $70 a month for a bigger slice, then charge the clients for hosting. If you're creative with Passenger pools and timeouts, you can balance it out so that you can squeeze quite a few Rails apps on one box and actually turn a profit while still giving them good performance.
|
# ? Apr 28, 2009 22:46 |
|
Arachnamus posted:This is probably not the best way to do this. wunderbread384 posted:Thanks for the responses guys, I figured out that I was doing things the hard way. Trying to learn subversion and rails at the same time had me very confused but I've worked out that step of the problem and have gotten to be able to start messing around with rails =)
|
# ? Apr 28, 2009 22:46 |
|
|
# ? May 15, 2024 23:03 |
|
Jargon posted:If you have multiple clients with low-to-medium traffic websites, you can spend $38 or $70 a month for a bigger slice, then charge the clients for hosting. If you're creative with Passenger pools and timeouts, you can balance it out so that you can squeeze quite a few Rails apps on one box and actually turn a profit while still giving them good performance. I'm guessing that I will make the money from clients to scale without much $$$ worry
|
# ? Apr 28, 2009 22:53 |