|
I'm using https://github.com/rails-api/active_model_serializers Works well, but then again, I don't need any fancy features for this project. YMMV.
|
# ? Aug 21, 2013 05:53 |
|
|
# ? May 15, 2024 03:44 |
|
Smol posted:I'm using https://github.com/rails-api/active_model_serializers This is what I've preferred for simple ones as well, but I've found it falls over when you want more than one way of looking at the same model. I also didn't throw more than a few hours at trying to get it to work though, so
|
# ? Aug 21, 2013 16:21 |
|
I'm having trouble installing recent versions of Ruby onto my OSX computer. I tried using the RVM, but it somehow managed to mess up whatever version I was using at the time. What's the most newbie-friendly recommended way to install Ruby, Rails, and whatever?
|
# ? Aug 21, 2013 18:04 |
|
Pollyanna posted:I'm having trouble installing recent versions of Ruby onto my OSX computer. I tried using the RVM, but it somehow managed to mess up whatever version I was using at the time. What's the most newbie-friendly recommended way to install Ruby, Rails, and whatever? RVM is supposed to be the easiest. You install RVM, install a ruby, then run code:
http://railsinstaller.org/en#osx
|
# ? Aug 21, 2013 18:27 |
|
kayakyakr posted:RVM is supposed to be the easiest. You install RVM, install a ruby, then run Cool, I got it to work this time So...is there an IDE I should use? I'm used to whatever weirdo terminal Codecademy has, but I don't know if there's anything like this for OSX. Or does that not make sense?
|
# ? Aug 21, 2013 18:45 |
|
Commence argument about Sublime Text.
|
# ? Aug 21, 2013 18:57 |
|
JetBrain's RubyMine is worth the money if you need a full featured IDE.
|
# ? Aug 21, 2013 19:08 |
|
Rubymine rocks.
|
# ? Aug 21, 2013 19:10 |
|
I hated rubymine. Way more than you could ever need and java-based so it's performance was horrible.
|
# ? Aug 21, 2013 19:23 |
mVim or gVim is the only way... Or emacs if you're weird like that. Seriously vim+terminal will do everything you need for rails development.
|
|
# ? Aug 21, 2013 19:25 |
|
Pollyanna posted:I'm having trouble installing recent versions of Ruby onto my OSX computer. I tried using the RVM, but it somehow managed to mess up whatever version I was using at the time. What's the most newbie-friendly recommended way to install Ruby, Rails, and whatever? Install homebrew, then code:
|
# ? Aug 21, 2013 19:31 |
|
dexter posted:Install homebrew, then unless you run the auto rehash plugin theres going to be a couple code:
|
# ? Aug 21, 2013 19:59 |
|
Kallikrates posted:unless you run the auto rehash plugin theres going to be a couple Really should be built-in functionality, but what can you do? (happy rbenv user here, screw rvm)
|
# ? Aug 21, 2013 20:06 |
|
Okay, well, I went with Sublime. I understand that CMD-B does Build, but how do I get it so that I can input stuff, like for gets? edit: Also, what does Ruby do besides Rails? I'm not necessarily interested in web development or maintaining servers, so any other things it can do (i.e. miniature OSX applications, small games, GUIs) I'd like to hear about. Pollyanna fucked around with this message at 20:22 on Aug 21, 2013 |
# ? Aug 21, 2013 20:17 |
|
tldr+warning: rails noob(?) not sure what I know, what to do next. I'm trying to figure out where my Rails skills are, in terms of looking for a job and areas of further self-study. I remember reading two interesting takes on what an entry level rails dev should know. The SO answer places me pretty comfortably at the entry level which makes me uncomfortable since I don't really feel job ready at all(partly because I have no idea what an entry level dev would do). Aside from some guided tutorial applications so far I've done one serious full app. It's a glorified blog with an ActiveAdmin backend, that can also send out a newsletter/manage subscriptions, does RSS and posts to its own FB page, can handle attachment files/images through paperclip and dropbox. Zurb Foundation front-end, no custom JS. Deployed to Heroku, running on PG. Also completely untested. The hardest part of the whole thing was probably figuring out the AA DSL and setting up the whole email system. Basically, it feels like I've bumped into most everything that web tutorials touch on and a bit more. As a designer I feel I have no idea what to do beyond looking at templates and copying them(though I feel comfortable with SCSS/html(as long as I know what look I want to produce), and copy-paste-tweak capable with js). In terms of the heavy programming(what would count as heavy?) I feel sort of comfortable identifying a problem and then googling around for a solution, but I struggle to identify the next step in the first place(yes, that's what TDD is for, I didn't use it for my first real app since I wanted to use ActiveAdmin). I feel like I can do any basic task as long as I can google for it, but I'm terrified of going into an interview since I use SO/railscasts/etc non-stop while I work. Looking at interview prep blog posts they talk about patterns and algorithm implementation which is stuff that I've never used for rails programming, so far(I think). Finally, the question, what do I do? Applying for a job is a bit of a non-starter since I'm Romanian and there's like one Rails company in the country. I think I can start looking for contract work just because from what PHP friends tell me most of their work is, pretty much, building glorified blogs/simple CMSs for small companies. I built a super basic e-commerce site with Spree months back and that seemed easy as well. Should I look for some open-source rails projects and contribute/study them(recommendations?) e. Sublime guy: why would you build anything? Save your files and reload whatever webpage you are working on. You started the server from the commandline, right? Sublime is just for editing your files, it doesn't run a server or show you browser output(ie. the actual web pages). e2. Here's a way overdetailed workflow intro with Sublime Text 2. Sil fucked around with this message at 20:24 on Aug 21, 2013 |
# ? Aug 21, 2013 20:20 |
|
Sil posted:e. Sublime guy: why would you build anything? Save your files and reload whatever webpage you are working on. You started the server from the commandline, right? Sublime is just for editing your files, it doesn't run a server or show you browser output(ie. the actual web pages). Err well, I just edited my post up there to clarify, but I'm not really working on web applications right now. I'm starting with simple scripts and hopefully coming to the point where I can click on a binary and it'll run for me.
|
# ? Aug 21, 2013 20:23 |
|
Ruby can do scripts, I think you just want to navigate into the file folder with the Terminal and then run "ruby filename.rb" which will execute the ruby file. Ruby doesn't build, I don't think, since it doesn't have a compiler. Just save your *.rb file and run it. e. "puts" prints to terminal, btw so you can have your first ruby program just be a file named "hello.rb" with the content "puts "hello"". Go in that folder with terminal and run it with "ruby hello.rb" e2. ruby is interpreted, not compiled, so I don't think you ever get to it producing a binary for you. Just run it from the command line. e3. Rails accounts for most of what Ruby is used for. I think Ruby is also used to for testing(from what I remember in old jobs posts I browsed) other programs, but it's very much a nice thing. Sil fucked around with this message at 20:30 on Aug 21, 2013 |
# ? Aug 21, 2013 20:25 |
|
Sil posted:Ruby can do scripts, I think you just want to navigate into the file folder with the Terminal and then run "ruby filename.rb" which will execute the ruby file. Ruby doesn't build, I don't think, since it doesn't have a compiler. Just save your *.rb file and run it. Right, I forgot. So how do people make games and applications in Ruby, then? Is everything just run from the terminal?
|
# ? Aug 21, 2013 20:29 |
|
I'm not sure. I would assume you can just have an executable file that's essentially a wrapper that issues command-line type commands when you click it sort of like how I think bash script files work. e. see this for packaging ruby scripts into an app on OS X Sil fucked around with this message at 20:37 on Aug 21, 2013 |
# ? Aug 21, 2013 20:34 |
|
kayakyakr posted:I hated rubymine. Way more than you could ever need and java-based so it's performance was horrible. I hope that you're not seriously as a Ruby developer complaining about Java performance.
|
# ? Aug 21, 2013 20:42 |
|
The Journey Fraternity posted:Really should be built-in functionality, but what can you do? I'll go further and recommend GitHub's Boxen. You get rbenv for free, along with boatloads of other stuff.
|
# ? Aug 21, 2013 21:32 |
|
Sil posted:I remember reading two interesting takes on what an entry level rails dev should know. Huh, what? I threw together a Rails app in my spare time, maybe 4 hours a day on average of just under a month, and I can do all the entry-level stuff on the SO link and have done most (and understand the rest) of the mid-level stuff. Does anyone here actually agree with that? Surely things have changed in the three-ish years since it was posted? E: According to this link, I'm a rookie: http://smsohan.blogspot.ca/2010/02/ruby-on-rails-interview-questions_23.html Because I could only get like two of the questions. Safe and Secure! fucked around with this message at 23:40 on Aug 21, 2013 |
# ? Aug 21, 2013 23:37 |
|
Smol posted:I hope that you're not seriously as a Ruby developer complaining about Java performance. Java GUI performance on Linux machines using any sane upper memory limit is pretty terrible. Maybe on mac, rubymine runs better? I dunno, to me it was pretty crap. Sil posted:tldr+warning: rails noob(?) not sure what I know, what to do next. Reading through that, you're absolutely entry level rails. You have more experience with Rails than the last guy I hired. If you understand programming and understand how to get things done, you'll be ok. Pollyanna posted:Right, I forgot. So how do people make games and applications in Ruby, then? Is everything just run from the terminal? Mostly run from terminal or started as a server. It is possible to write desktop apps in ruby, though. Ruby Toolbox is a great place to look up what sort of things people have come up with. https://www.ruby-toolbox.com/categories/game_libraries https://www.ruby-toolbox.com/categories/packaging_to_executables https://www.ruby-toolbox.com/categories/GUI_Frameworks
|
# ? Aug 21, 2013 23:52 |
|
A MIRACLE posted:Seriously vim+terminal will do everything you need for rails development. vim+tmux is pretty drat killer. Especially if you remote connect to your development machine, never lose a thing from disconnect/reboots/crashes again. Also, to go back to the cucumber thing a bit ago: Don't, don't, don't use it if you work by yourself or stakeholders() aren't going to look at them. It's a complete waste of time and a maintenance nightmare. Just use rspec+capybara.
|
# ? Aug 22, 2013 01:57 |
|
kayakyakr posted:Java GUI performance on Linux machines using any sane upper memory limit is pretty terrible. Maybe on mac, rubymine runs better? I dunno, to me it was pretty crap. Works fine for me on both Mac and Linux. Both machines have an SSD and at least 16 gigs of ram though - maybe that's the key difference. Smol fucked around with this message at 14:13 on Aug 22, 2013 |
# ? Aug 22, 2013 10:54 |
A little late to the whole RSpec thing but the problem I've always had with it is that the semantics seem to change with every other version and the team working on it can't stick to anything. I haven't really used Cucumber all that much and it seems like it could become a bit bloated, although it seems more straightforward than RSpec in a lot of ways because you only end up with the natural language in the feature file opposed to a bunch of ugly code blocks everywhere. What is the deal with Shoulda? Just glancing at the Github readme it kind of seems like a cut down RSpec (with regards to being based around shoulds)? I have a few projects I'm working on where at least a couple of them might need some test rewrites, so I could probably do some experimenting this weekend.
|
|
# ? Aug 22, 2013 17:08 |
|
Tru cucumber. I'm on day 3 of migrating all my integration tests from rspec to cucumber and it's awesome. It sounds awful in theory but it's awesome in practice. Keeping bloat down feels really natural compared to rspec. DONT THREAD ON ME fucked around with this message at 18:16 on Aug 22, 2013 |
# ? Aug 22, 2013 18:08 |
|
Quick question about assigning class variables: Can I do something like foo.bar.baz = foo? Specifically, for doing binary tree peer linking, can I say node.left.nextright = othernode? I'm getting a nomethoderror, so what I guess is happening is it thinks that nextright is a non-existent method in the class, but nextright is one of the node class variables.
|
# ? Aug 23, 2013 07:42 |
|
Try adding attr_accessor :nextright to the class. Instance variables are private in ruby, the only way you can modify them from outside is via methods.
|
# ? Aug 23, 2013 11:41 |
|
chumpchous posted:Tru cucumber. I'm on day 3 of migrating all my integration tests from rspec to cucumber and it's awesome. Would you be willing to share a before/after of one of your tests? I'm thinking of adding Cucumber into a site that I've been managing for a few years. Our business-end client is exactly the kind of guy who can read and understand natural language features so I'm thinking it could be a good fit, but every time I sit down to write cucumber tests I feel like I'm wasting my time programming to a crazy DSL rather than just telling it what I want to test.
|
# ? Aug 23, 2013 13:17 |
|
gucci void main posted:What is the deal with Shoulda? Just glancing at the Github readme it kind of seems like a cut down RSpec (with regards to being based around shoulds)? For me, shoulda's a way to get nested contexts with MiniTest::Unit assertions, and a handful of Rails-specific test helpers. Ruby code:
|
# ? Aug 23, 2013 17:17 |
|
The Journey Fraternity posted:Really should be built-in functionality, but what can you do? gem install rbenv-rehash Smol posted:I hope that you're not seriously as a Ruby developer complaining about Java performance. I wouldn't use an IDE written in Ruby either if it was as slow as RubyMine is. What a lemon.
|
# ? Aug 23, 2013 17:36 |
|
prom candy posted:Would you be willing to share a before/after of one of your tests? I'm thinking of adding Cucumber into a site that I've been managing for a few years. Our business-end client is exactly the kind of guy who can read and understand natural language features so I'm thinking it could be a good fit, but every time I sit down to write cucumber tests I feel like I'm wasting my time programming to a crazy DSL rather than just telling it what I want to test. Yeah let me find some less embarrassing code. I'm pretty new to testing so my before/afters might not be a great example, but maybe you guys can give me some pointers. Question: I had a bug in my application that was causing the DB to lock up when a form got double posted. I switched to postgres and fixed some issues, but I've never actually managed to replicate the bug. The post is submitted via JSON, and I've tried just sending multiple JSON posts but it wont happen. I've also tried manually clicking the button really fast but that doesn't do it either. Still though, users are managing to pull it off. Any tips?
|
# ? Aug 23, 2013 18:01 |
|
chumpchous posted:Question: I had a bug in my application that was causing the DB to lock up when a form got double posted. I switched to postgres and fixed some issues, but I've never actually managed to replicate the bug. The post is submitted via JSON, and I've tried just sending multiple JSON posts but it wont happen. I've also tried manually clicking the button really fast but that doesn't do it either. Still though, users are managing to pull it off. Any tips? What do you mean lock up? Are you seeing deadlocks in your postgres logs? What kind of locking (if any) are you doing on your models?
|
# ? Aug 23, 2013 18:27 |
|
chumpchous posted:Question: I had a bug in my application that was causing the DB to lock up when a form got double posted. I switched to postgres and fixed some issues, but I've never actually managed to replicate the bug. The post is submitted via JSON, and I've tried just sending multiple JSON posts but it wont happen. I've also tried manually clicking the button really fast but that doesn't do it either. Still though, users are managing to pull it off. Any tips? Were you using sqlite? Were you using a multi-instance server like unicorn? If so, that was your problem.
|
# ? Aug 23, 2013 19:29 |
|
Yeah I was using SQLite, and now I'm using postgres, so the problem is fixed. I just want to know how to test for the error, because I can't replicate it (on a server using an SQLite db).
|
# ? Aug 23, 2013 19:37 |
|
chumpchous posted:Yeah I was using SQLite, and now I'm using postgres, so the problem is fixed. I just want to know how to test for the error, because I can't replicate it (on a server using an SQLite db). The problem is sqlite is single threaded. It works until someone hits the database at the same time as someone else. If you were using unicorn, this would happen any time two requests are submitted at the same time. You can't really test for the error, you just have to know that if you're using sqlite, you can only use one server process at a time.
|
# ? Aug 23, 2013 21:21 |
|
Smol posted:Try adding attr_accessor :nextright to the class. Instance variables are private in ruby, the only way you can modify them from outside is via methods. I tried this, but I'm now thinking that the problem is maybe in the binary tree library I'm using. When I populate the tree it says that every element's left AND right is the next element in the tree. Is there a reliable binary tree library out there?
|
# ? Aug 23, 2013 22:10 |
|
Cocoa Crispies posted:For me, shoulda's a way to get nested contexts with MiniTest::Unit assertions, and a handful of Rails-specific test helpers. Is it common to write a test for all your relationships and validations? It seems like overkill to me.
|
# ? Aug 24, 2013 02:08 |
|
|
# ? May 15, 2024 03:44 |
|
Are there any decent ruby gems for doing decent visualizations, in the form of graphs/charts/maps/anything? I have a bunch of varied datasets that I've been asked to make interesting with, and all of my code that works with the api is ruby-based so I'd like to just carry on with that.
|
# ? Aug 24, 2013 02:21 |