|
Plastic Jesus posted:You really, really, really don't want to execute shell commands from a script that accepts user-supplied data. I also doubt that you'd want to be able up/down a network interface or change its IP address via a web application. It would be for a couple internal people to use, instead of ssh'ing into the server and running commands. It'd actually be for 'clone database', 'sync database' and 'dump database'
|
# ? Jun 24, 2011 13:47 |
|
|
# ? May 15, 2024 02:55 |
|
What are some good books for learning rails? I have basic programming experience (Java,C++), and I already know some ruby. How popular is ruby in the job market?
|
# ? Jun 28, 2011 00:12 |
|
5436 posted:What are some good books for learning rails? I have basic programming experience (Java,C++), and I already know some ruby. If you already have core concepts of Ruby down then Rails will go much easier than most. This is the book for you. Ruby is still somewhat niche but like other niche things you can find a sweet gig that pays great and you'll love being there because you're with like-minded people that appreciate beauty and simplicity. Either that or some hot startup like thing that uses Rails because Rails is/was the new hotness and the startup crashes and burns after a few years because it's inept; but hey as long as the paychecks cash.
|
# ? Jun 28, 2011 01:24 |
|
I don't know about everywhere else, but here in SF, Rails seems like the hottest poo poo ever shat. ("poo poo" not intended as a pejorative)
|
# ? Jun 28, 2011 01:28 |
|
I don't think I have the core concepts of ruby down. I've written some basic ruby (cucumber poo poo) but I have no idea how to start from scratch. I never majored in comp sci so I don't have a high level understanding of CS either.
|
# ? Jun 28, 2011 04:27 |
|
I found Pragmatic's Programming Ruby 1.9 to be very good at teaching the language from end-to-end, including gem distribution, project structure (the book taught me /bin and /lib ), which a lot of language books seem to assume the reader to already know. A CS degree is like an Architecture degree: you don't technically need one in order to work on houses....no, wait, that's not right. Okay, being a computer scientist is like being an architect, and being a developer is like being a building contractor: there's a fair amount of overlap between the jobs, and one is more abstract than the other, but they aren't exactly the same thing, and building houses is a business you can join without any specialized schooling at all, as long as you can self-teach and spend plenty of time practicing the craft (hopefully because you enjoy it). Anyway, you can always just read Structure and Interpretation of Computer Programs off MIT's OpenCourseWare site and know more CS-stuff than 90% of developers.
|
# ? Jun 28, 2011 04:57 |
|
5436 posted:I don't think I have the core concepts of ruby down. I've written some basic ruby (cucumber poo poo) but I have no idea how to start from scratch. I never majored in comp sci so I don't have a high level understanding of CS either. Do the Ruby Koans.
|
# ? Jun 28, 2011 15:41 |
|
My favorite book for pure ruby is The Ruby Way. Everyone here loves it as well.
|
# ? Jun 28, 2011 17:56 |
|
What about resources for people who are fine with Ruby but need the Rails stuff? Just got handed an exploratory project using RoR and I am NOT a web programmer - I understand why MVC is the way it is, but that's about as far as I've gotten. I already have my project done in plain Ruby but now have to integrate it into Rails to merge with the rest of the code base. All I need is a web form that accepts a single field, pipes that input into a Ruby function, then displays results. I could do it in PHP in 5 minutes but this Rails stuff seems totally overboard and mysterious
|
# ? Jun 28, 2011 18:08 |
|
GodIsInTheTrees posted:I could do it in PHP in 5 minutes but this Rails stuff seems totally overboard and mysterious
|
# ? Jun 28, 2011 18:42 |
|
GodIsInTheTrees posted:All I need is a web form that accepts a single field, pipes that input into a Ruby function, then displays results. I could do it in PHP in 5 minutes but this Rails stuff seems totally overboard and mysterious I've always liked this tutorial: http://guides.rubyonrails.org/getting_started.html Once you go through this you'll see that making a form that accepts input is a 15 second task with Rails and scaffolding.
|
# ? Jun 28, 2011 19:01 |
|
GodIsInTheTrees posted:What about resources for people who are fine with Ruby but need the Rails stuff? Just got handed an exploratory project using RoR and I am NOT a web programmer - I understand why MVC is the way it is, but that's about as far as I've gotten. I already have my project done in plain Ruby but now have to integrate it into Rails to merge with the rest of the code base. You want Sinatra or Padrino. <3 Padrino, it's an awesome middle ground between Sinatra and Rails.
|
# ? Jun 28, 2011 19:16 |
|
8ender posted:I've always liked this tutorial: Working through this now! To everybody else: I've already figured out this is massive overkill, but I have no choice (yay work). This is an "exploratory" project to weigh pros and cons of RoR, so I absolutely HAVE to use Rails... Thanks for all the help!
|
# ? Jun 28, 2011 22:53 |
|
So I keep getting this error on my heroku app:code:
code:
|
# ? Jun 28, 2011 23:38 |
|
There's String#empty?, but no NilClass#empty? method. If r.email is nil rather than an empty String you'll get that error.
|
# ? Jun 29, 2011 00:34 |
|
Soup in a Bag posted:There's String#empty?, but no NilClass#empty? method. If r.email is nil rather than an empty String you'll get that error. Ahh ok, well I changed it to .blank? and it seems to work fine. thanks! OK, so Ive set up my mailer in Rails which works fine, but I wanted to make a new action (or maybe just a view?) to have a slimmed down contact form in a lightbox so you can email a specific user from their profile. I can do that all fine and dandy but it would use the default layout which I dont want. So I added: code:
code:
code:
rugbert fucked around with this message at 11:41 on Jun 29, 2011 |
# ? Jun 29, 2011 00:39 |
|
I'm not sure what you're trying to do, but lightbox is a JS tool for fancy image viewing. Why are you using it to show a form? I don't get it. render :layout => 'something' is to change the layout you are using for that action, which may not be what you want to do. Read up on it here. And the :as => :contacts in your routes is unnecessary. It would be named that anyway.
|
# ? Jun 30, 2011 02:08 |
|
I'm a total idiot when it comes to testing and tdd/bdd. I would really appreciate if anyone could give some guidelines/opinions on the right way to do things, frameworks to use (or to avoid) -- really just throw anything at me and I'll be grateful. I'm working on something now and I want to add tests to it, but in the future I'd like to get into the habit of writing tests for code right alongside of the code I'm writing. I just can't seem to get there, mentally. PS - I'm thinking about using Capybara and RSpec, mainly on the strength of this post. smug forum asshole fucked around with this message at 17:19 on Jun 30, 2011 |
# ? Jun 30, 2011 16:39 |
|
Cock Democracy posted:I'm not sure what you're trying to do, but lightbox is a JS tool for fancy image viewing. Why are you using it to show a form? I don't get it. Well, Im using colorbox actually (which also displays webpages), I just thought it would be cool way to send an email. you know, like you click "send so and so a message" and a lightbox with a small form pops up. I need to use a different layout tho, so that way ONLY the form is shown. If I use the default layout then Ill have all this other shown like the navbar, footer, header ect ect
|
# ? Jun 30, 2011 23:05 |
|
Sorry if this is not a Rails question specifically, but I didn't know where else to post it. I'm new to Ruby. I wrote this simple one-line script in an analyzer.rb file: code:
>ruby analyzer.rb analyzer.rb:1:in `initialize': No such file or directory - text.txt (Errno::ENOENT) from analyzer.rb:1:in `open' from analyzer.rb:1:in `<main>' >Exit code: 1 The thing I don't understand is that both the analyzer.rb and text.txt files are located in C:\Ruby\bin folder, which is where ruby.exe is located. Considering this, why am I getting this error? Slow News Day fucked around with this message at 05:17 on Jul 4, 2011 |
# ? Jul 4, 2011 05:15 |
|
enraged_camel posted:Considering this, why am I getting this error? code:
|
# ? Jul 4, 2011 05:31 |
|
skidooer posted:The search path will be your current working directory, not the location of the script. If test.txt will always be located along side the script, you can do something like this: Thank you, I'll try that. Dumb question: how do I find out what my current working directory is? I mean, all I'm doing is pressing F5 within SciTE. edit: that didn't work either. I get a very similar No such file or directory - ./text.txt (Errno::ENOENT) error. edit2: I figured it out by discovering Dir.pwd, which showed me the working directory. It was C:\Ruby192. Holy hell. vvvvvv yeah Slow News Day fucked around with this message at 06:59 on Jul 4, 2011 |
# ? Jul 4, 2011 05:36 |
|
I think you can get the current working directory with Dir.pwd.
xtal fucked around with this message at 05:52 on Mar 30, 2012 |
# ? Jul 4, 2011 06:58 |
|
I'm starting to learn about polymorphic associations, and have run into a road block of sorts. So far I have followed and understood the basic concepts presented by ryan baits in episode #154, and have even created the same basic app. I can create new comments, and destroy, however I cannot figure out how to edit them. I understand that I should be using edit_polymorphic_path or edit_polymorphic_url, and am even 99% sure I am passing in the right models. However when I click the link I get a hash error, which may suggest something is wrong with my controller. so... does anyone have a working example or know of one that shows a complete polymorphic association in action? My final goal is to create a polymorphic image model with carrierwave, but cannot find many working examples. Or should I avoid using polymorphic associations all together?
|
# ? Jul 5, 2011 00:30 |
|
So as per my last post I started using RSpec. I'm not very good, but I think I'll get better with time. Where I'm dumbest right now is testing authenticated users (Devise, Omniauth). I couldn't figure out how to properly mock an authenticated User that takes advantage of Devise's current_user helper method, but luckily I found a post where someone had the same problem as me. I ended up doing something like this, where the warden environment variable gets mocked up. See comment: code:
|
# ? Jul 5, 2011 20:58 |
|
Here's a terrible association-related question for the thread I appear to have killed: I have Groups, Users, and Posts as models. I want a User to be able to create a Group. If a Group with a given name already exists, I want the User to be able to associate with that Group. Once a User has associated with a Group, they should be able to create Posts that are associated with that Group. A User should be able to see all Posts associated with a Group, and all Users should be able to see other Users I'm thinking: code:
|
# ? Jul 8, 2011 05:45 |
|
HABTM is generally used with legacy schemas because you can't manipulate the intermediate join, which you don't think you will at first but you will. When I started with Rails so many years ago I always did HABTM because it was easier to understand and every time I regretted it and switched to has_many :through. http://guides.rubyonrails.org/association_basics.html#choosing-between-has_many-through-and-has_and_belongs_to_many
|
# ? Jul 8, 2011 05:53 |
|
NotShadowStar posted:HABTM is generally used with legacy schemas because you can't manipulate the intermediate join, which you don't think you will at first but you will. When I started with Rails so many years ago I always did HABTM because it was easier to understand and every time I regretted it and switched to has_many :through. I'd really like to do has_many :through, but I can't grasp how to make it sense with this problem.
|
# ? Jul 8, 2011 05:57 |
|
You already have it , though you should probably use Group as the central model instead of Postcode:
|
# ? Jul 8, 2011 06:03 |
|
Is it possible for a User to create a Group without creating a Post to intermediate the relationship that way? Sorry I'm having trouble grasping this
|
# ? Jul 8, 2011 06:13 |
|
NotShadowStar posted:You already have it , though you should probably use Group as the central model instead of Post The Post model isn't the Group membership: code:
|
# ? Jul 8, 2011 15:46 |
|
BonzoESC posted:The Post model isn't the Group membership: I think he wants this code:
|
# ? Jul 9, 2011 00:28 |
|
I'm running into an issue implementing a simple contact form using this http://www.railsmine.net/2010/03/rails-3-action-mailer-example.html example. Basically I changed it from support to contact, and although I believe the code is all correct, it will not render the form partial for the contact controller. What could be causing this?
|
# ? Jul 10, 2011 05:59 |
|
If you're not getting any errors but the partial just doesn't seem to be showing up, the obvious typo to check for is using <% render instead of <%= render.
|
# ? Jul 10, 2011 12:14 |
|
No that is the first thing I look for now, and I noticed the typo in the tutorial. I have however solved my own problem, it only required 6 hours of sleep to track it down. Thanks for the suggestion.
|
# ? Jul 10, 2011 15:30 |
|
enki42 posted:div city Everything I make is div city. I've tried doing it properly. I've done tables before, but for some reason my clients love the fact that I use divs.
|
# ? Jul 11, 2011 17:56 |
|
ZanderZ posted:Everything I make is div city. I've tried doing it properly. I've done tables before, but for some reason my clients love the fact that I use divs. Wow, that has to be the king of blast-to-the-past quoting. I had to use forums search to find where my original post came from, and it's from 3 years before I was actually a Ruby dev For the record, I still like the idea of Haml, but it still puts divs up on an undeserved pedestal. A div tag should be the tag of last resort, not the default. Whenever you use a div, you're basically giving up and saying 'welp, i can't assign any semantic meaning to this thing at all.' Haml really ought to require specifying tags. Sass is the bomb though, particularly in SCSS syntax.
|
# ? Jul 12, 2011 19:11 |
|
I've run into something in Rails 3 that I don't understand. Assume I have the following models:code:
code:
code:
|
# ? Jul 12, 2011 23:04 |
|
Plastic Jesus posted:Then if I want to create a new user in the user controller this will not work: code:
Personally, given your input, I'd be inclined to do something like this: code:
skidooer fucked around with this message at 23:57 on Jul 12, 2011 |
# ? Jul 12, 2011 23:54 |
|
|
# ? May 15, 2024 02:55 |
|
skidooer posted:If we add brackets, your code is equivalent to this: Do'h, thanks. I assumed that it was something syntactical I was missing from staring at the same code for too long. Thanks also for the tip of adding a setter method, which may be useful for more than 1 reason.
|
# ? Jul 13, 2011 00:06 |