|
You really, really should read the book. The PDF is really cheap. You're thinking Java, and Ruby is the anti-Java. Nothing in Ruby is nowhere near as complicated as you're making it to be, unless it's from a Java refugee that doesn't know better yet.
|
# ? Oct 14, 2010 16:57 |
|
|
# ? May 14, 2024 00:49 |
|
Having an issue getting rvm installed on my Ubuntu machine. I followed the directions, but the problem is that the script directory which rvm is expected to be in is "$HOME/.rvm/scripts/rvm", but it is actually in "$HOME/.rvm/src/rvm/scripts/rvm" I modified this code in .bashrc and .bash_profile for the difference, but the system is still expecting rvm to be in the default directory. code:
code:
Followed the installation instructions here (http://rvm.beginrescueend.com/rvm/install/) and consulted elsewhere. Anyone else encounter this issue or know of a solution? TIA
|
# ? Oct 15, 2010 12:14 |
|
Im also having trouble with Ruby on Rails in Ubuntu. I just installed 10.10 desktop (64bit). I installed ruby via apt, installed gem manually, and rails from gem. I was able to create a new rails project, but when I tried to make models it errors out. It claims that the rails gem isnt installed and to run bundle install. After running bundle install, the install errors out saying something about not having a file call mkmf. The internet told me that apt did not install ruby1.8-dev. did that which did hte trick, but now im having issues with the sql gem. Anytime I try to install it, either by adding a line to my gem file or with gem install I get an code:
|
# ? Oct 15, 2010 16:41 |
|
rugbert posted:Anytime I try to install it, either by adding a line to my gem file or with gem install I get an
|
# ? Oct 15, 2010 17:03 |
|
Obsurveyor posted:Have you installed a compiler to be able to build native extensions? I think it is apt-get install build-essential Yes indeed. This is what Im getting code:
|
# ? Oct 15, 2010 17:23 |
|
rugbert posted:Yes indeed. This is what Im getting
|
# ? Oct 15, 2010 18:06 |
|
Yup, need libmysqlclient15-dev (or whatever it's named in 10.10, that was the name back in 8.04) and also ruby1.8-dev. I think those two plus build-essential covers everything.
|
# ? Oct 15, 2010 19:37 |
|
hostile apostle posted:Having an issue getting rvm installed on my Ubuntu machine. rm -rf ~/.rvm and start again from code:
|
# ? Oct 15, 2010 19:47 |
|
Obsurveyor posted:mysql-dev libraries installed too? yup thats it, thanks! huh, didnt it used to be mysql-dev? I had to install libmysqlclient15-dev. edit - wtf, ok, I just tried to create a new model, bam it worked. Migrated, checked my sql database and there is a table with that model name. Cool. But for whatever reason, the model file isnt showing up in my models folder? edit 2 - i just made a second model and that worked. guess ill have to play around rugbert fucked around with this message at 23:37 on Oct 15, 2010 |
# ? Oct 15, 2010 19:48 |
|
NotShadowStar posted:rm -rf ~/.rvm and start again from sweet, this worked thanks. now a new question: mysql or sqlite? I'm using railstutorial.org right now and he uses sqlite, but for the future, what are the pros and cons of each?
|
# ? Oct 16, 2010 13:27 |
|
hostile apostle posted:sql or sqlite? For development use sqlite. It's one less thing to worry about since you don't need to have any sql server running for your app to work. For production use postgresql. It's the best open source sql server. There's no reason ever to use mysql However, I'm obligated at this point to pimp couchdb. But if you're also learning rails at the same time, it'll be easier to stick with active record.
|
# ? Oct 16, 2010 14:38 |
|
Master_Odin posted:Apparently I can't even make something as simple as a mail form. Im with you buddy. I found that same contact form tut, but Im using rails 3 so I dont know how to set those resources. Im just starting out with rails and my loving boss only talks to me like Ive had experience with RoR before. Anyone know of a good Contact Form guide for rails 3?
|
# ? Oct 20, 2010 15:57 |
|
Does anyone here have experience making a versioned API in rails? I'm wondering if there are any sort of best-practices or lessons learned out there as far as organizing routes and controllers and models go.
dustgun fucked around with this message at 17:25 on Oct 20, 2010 |
# ? Oct 20, 2010 17:21 |
|
You mean like api.clownpenis.fart/v1 and api.clownpenis.fart/v2? Just do a sub-uri deployment on the entire project of each versioned API. Passenger makes this really, really easy.
|
# ? Oct 20, 2010 18:46 |
|
I have another very rudimentary question. I recently reworked my app in progress which until recently had three separate models called "Game", "Movie", and "Product" - but they all basically had the same controller structure and had nearly identical views and model definitions. To prevent this repetition, I have created a model called "Thing" and I subclassed it to create "Game", "Movie", and "Product" models. So my model definition for "Game" looks like this: code:
Right now if I do: code:
EDIT: Would I be better off going back to my 3 separate model solution, each having their own table? Meaning, I would not have a very DRY app, but at least I could rely on Rails conventions without much extra hassle. plasticbugs fucked around with this message at 20:36 on Oct 20, 2010 |
# ? Oct 20, 2010 20:25 |
|
plasticbugs posted:
Yes. Don't do what you did. It's clever, but unnecessary. Sometimes DRY goes too far. Also, subclassing doesn't do what you think it does. If your models are overlapping, then you need to normalize the database anyway.
|
# ? Oct 20, 2010 22:37 |
|
NotShadowStar posted:Yes. Don't do what you did. It's clever, but unnecessary. Sometimes DRY goes too far. Also, subclassing doesn't do what you think it does. It looks like a little repetition will likely save me from myself and the quirks of STI. Thanks for your help! I'll take a look at how I've structured my database to ensure I'm not overly complicating it. Having "Games", "Movies" and "Products" in separate tables seems like it may speed up queries, and will at the very least simplify my queries.
|
# ? Oct 20, 2010 23:53 |
|
I got my contact form working for the most part. I cant get the actionmailer to send the contents of the mailer file tho.code:
|
# ? Oct 21, 2010 19:21 |
|
I need a login system for my simple CMS site. Instead of rolling my own, I'd like to use an existing library/gem. Between Authlogic, Devise and Omniauth, which do you guys recommend for an absolute beginner? I was leaning towards Devise. I wanted to avoid rolling my own simply because I think I'd actually learn more by working with modules and figuring out how to integrate them into an existing project (something I haven't quite done yet). Edit: Holy poo poo. Devise is dumb simple to use and configure. I think I have my answer. plasticbugs fucked around with this message at 09:32 on Oct 22, 2010 |
# ? Oct 22, 2010 07:45 |
|
Im having trouble with imagemagick on Ubuntu. I apt-get installed it, but I dont get any imagemagick command, so paperclip cant resize images im uploading. edit - Im a loving rear end in a top hat, I typed in :style instead of :styles rugbert fucked around with this message at 18:35 on Oct 25, 2010 |
# ? Oct 24, 2010 17:48 |
|
Please save me from myself. I'm interacting with the Amazon Product Advertising API. One of the item attributes kicks out a verbose, formatted product description. However, it prints to the browser as a bunch of escaped html entities, like so: ________________ <i>New Super Mario Bros. Wii.</i> Supporting 2-4 players in side-scrolling co-op and competitive platforming action, and featuring a mix of fan favorites and new characters, new powerups and various input options via the Wii Remote, it is destined to become an instant classic in one of the most beloved game franchises of all-time. <style type="text/css"> .caption { font-family: Verdana, Helvetica neue, Arial, serif; font-size: 10px; font-weight: bold; font-style: italic; } ul.indent { list-style: inside disc; text-indent: -15px; } ________________ I'm sure there's a built in Rails method that cleans this up, and prints to the browser as parsed HTML. I just don't know what it is. EDIT: I figured it out: require 'cgi' CGI.unescapeHTML() EDIT EDIT: For anyone that cares: Once you've unescaped the HTML entities, you still need to format your string with the html_safe method. Then, Rails will actually print the formatted HTML to the view. plasticbugs fucked around with this message at 06:00 on Nov 2, 2010 |
# ? Nov 2, 2010 05:30 |
|
Are there any good blog engines that run on Rails 3?
|
# ? Nov 3, 2010 18:16 |
|
Pretty much every rails shop either does a sub-uri/subdomain deployment of Wordpress or roll their own basic one. Wordpress is really the best thing out there, or if you just need something basic it's super fast to whip one out in Rails. There was Mephisto and Radiant but I don't think either of them work on Rails 3, and both of them were so twisted they were barely Rails anymore. There hasn't been much else because Wordpress is king, easy to install on absolutely any webhost. NotShadowStar fucked around with this message at 18:54 on Nov 3, 2010 |
# ? Nov 3, 2010 18:50 |
|
NotShadowStar posted:Pretty much every rails shop either does a sub-uri/subdomain deployment of Wordpress or roll their own basic one. Wordpress is really the best thing out there, or if you just need something basic it's super fast to whip one out in Rails. Any good tutorials on doing a sub-uri deployment of Wordpress in Rails 3? Most of the results I found deal with Rails 2.
|
# ? Nov 3, 2010 19:25 |
|
Yeah, Wordpress is solid but I've just been getting into Ruby (also Rails) and wanted a blog system to match while I'm redoing my website. Any non-Rails ruby blogging engines that are worthwhile?
|
# ? Nov 3, 2010 19:33 |
|
IsotopeOrange posted:Any good tutorials on doing a sub-uri deployment of Wordpress in Rails 3? Most of the results I found deal with Rails 2. The easiest and most dirty, if you're running in a server that has PHP support, is to make a directory in public/ and dump Wordpress in there. So if you make a directory public/blog and dump Wordpress in there, when you go to http://clownpenis.fart/blog it will pull the Wordpress index.php first. Otherwise if you're running Passenger on your server, and you drat well should be, you can keep them separated easier. In that instance you make an exception in your server's configuration file for the sub-uri and expicitly turn off Passenger, like this http://www.modrails.com/documentation/Users%20guide%20Apache.html#_passengerenabled_lt_on_off_gt The most clean I think is to do a sub-domain deployment with a virtual host, and don't enable Passenger or whatever your'e running your Rails app with for that virtual host. That's the most popular way of doing it, and it's perfectly clean since you have a complete separation of concerns if you need to rework your server layout in the future. Like this http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root quote:Yeah, Wordpress is solid but I've just been getting into Ruby (also Rails) and wanted a blog system to match while I'm redoing my website. You could literally make a simple blog in a couple minutes in Rails or Sinatra or anything, it's one of the 'gee whiz wow!' demos that frameworks always do. It depends on how extensive you want it. If you just want dated content posts it will take you just a couple minutes. Otherwise I can't think of anything because it's really easy to just deploy Wordpress and make a theme that matches the overall look of all of your sites. NotShadowStar fucked around with this message at 20:06 on Nov 3, 2010 |
# ? Nov 3, 2010 20:02 |
|
WordPress is really the easiest answer. If you insist it is rails, you can roll your own (with auth, comments, etc.) in a couple of hours. Radiant is a cool CMS, but as mentioned earlier it has diverged quite a bit from what you would consider normal Rails. It has a very flexible content structure, and can do a lot of really cool things, but it ends up not having good support for a blog. I used to roll with Radiant and have since switched to rolling custom CMSs when needed, since it was faster and easier.
|
# ? Nov 3, 2010 20:28 |
|
Unless you have several editors and update several times a day, there's absolutely no need for your blog to be dynamic. I use a ruby gem called webby, which lets me use haml and sass for layouts, do server side code hilighting, etc. It combines down to html, and rsycns to my host with a single rake task. My whole blog is then stored in git. Were I to do it again though I'd use jeckyll and just use github hosting.
|
# ? Nov 4, 2010 05:24 |
|
edit: Google solved my question
hmm yes fucked around with this message at 16:37 on Nov 4, 2010 |
# ? Nov 4, 2010 16:33 |
|
Actually now that I think about it a simple blog engine would be a great way to learn Couch/Mongo.
|
# ? Nov 4, 2010 18:40 |
|
I'm having a terrifyingly stupid problem. I'm migrating (or more accurately rewriting for the practice) a simple blog/vanity site to Rails 3/HAML. One feature of this site is a randomly selected quotation that shows up on every page. I have an admin page to create, update, and delete these quotations, which isn't working properly. When I try to update a quotation, it thinks I'm trying to call the destroy action instead. When I explicitly tell the form_for to call the update action, it claims one doesn't exist, despite it obviously showing up in rake routes. I didn't have this problem in my Rails 2/ERB iteration of the site. I'm sure I'm just doing something stupid, but I have no idea what. Help would be appreciated. Here's the relevant code: The quotes index view: code:
code:
|
# ? Nov 4, 2010 20:56 |
|
NotShadowStar posted:Actually now that I think about it a simple blog engine would be a great way to learn Couch/Mongo. Good idea. Time to have some fun...
|
# ? Nov 5, 2010 01:25 |
|
code:
And not to be that guy, but tables? edit: show off the %element= feature of haml Pardot fucked around with this message at 07:22 on Nov 6, 2010 |
# ? Nov 6, 2010 07:20 |
|
Why does rails support on shared hosting suck so much? I have one dude with Media Temple and to get rails running it is like performing open heart surgery. And Im trying to test out another site on go daddy shared hosting and while it seems pretty simple my rails app cant actually be found after Ive uploaded to the newly created rails folder. I think im going to move these guys over to linode or something.
|
# ? Nov 8, 2010 23:01 |
|
Lithium supports Rails on their shared hosting plans, in case you don't really need a VPS.
|
# ? Nov 8, 2010 23:18 |
|
rugbert posted:Why does rails support on shared hosting suck so much? fart It's mostly because shared hosts don't give a poo poo, it's really really easy with Passenger, the module is brain dead simple to install and enabling is just another directive in the VirtualHost configuration.
|
# ? Nov 8, 2010 23:25 |
|
rt4 posted:Lithium supports Rails on their shared hosting plans, in case you don't really need a VPS. Its not slow is it? I have a wordpress on a godaddy account thats painfully slow. NotShadowStar posted:fart Huh, well the price is right for what I need it for. When it says 20gigs database does that mean hosting space?
|
# ? Nov 9, 2010 02:46 |
|
It means what it says, the size of your database tables total. Heroku is a bit odd, it pre-compiles your app to a 'slug' when you push it and then loads the slug onto a read-only filesystem. Most apps are about 10-30 meg. Heroku is really really bad at serving static content. If you need attachments or other file type business you should use Amazon S3 or some such. I use S3, it's extremely easy and dirt cheap. Using Heroku for the Rails app and S3 for static assets, speed is not an issue.
|
# ? Nov 9, 2010 02:52 |
|
rugbert posted:Its not slow is it? I have a wordpress on a godaddy account thats painfully slow. I can't say much except that everything there has always been really responsive for me. There's also goon deals available in SA-Mart.
|
# ? Nov 9, 2010 04:25 |
|
|
# ? May 14, 2024 00:49 |
|
NotShadowStar posted:It means what it says, the size of your database tables total. Heroku does allow you to write to the tmp directory, but that's it.
|
# ? Nov 9, 2010 18:10 |