|
Nolgthorn posted:I've been toying around in Rails 4 using the screencast from Ryan Bates (that stuff is good). Answering my own question from a few pages ago in case it is helpful to someone else. Default support for Spec was one of the many things taken out of Rails 4 in order to expedite initial release so to get it working use this unofficial gem. https://github.com/metaskills/minitest-spec-rails
|
# ? Jan 21, 2013 09:17 |
|
|
# ? May 15, 2024 02:35 |
|
I've been using Sublime Text 2 for rails for a few weeks, and generally love it. However, after rebooting my machine today, its ruby linter is acting up. It is complaining about things like this:Ruby code:
Any idea what the hell is going on?
|
# ? Jan 22, 2013 20:02 |
|
The linter is checking your code with ruby 1.8 (probably the default system ruby), which doesn't have that hash syntax. Make sure you're getting the right version of ruby at the command line, and you might need to configure SublimeLinter to use a specific ruby instead of the default.
|
# ? Jan 22, 2013 20:19 |
|
Civil Twilight posted:The linter is checking your code with ruby 1.8 (probably the default system ruby), which doesn't have that hash syntax. Make sure you're getting the right version of ruby at the command line, and you might need to configure SublimeLinter to use a specific ruby instead of the default. Yeah, that makes sense, however: code:
code:
|
# ? Jan 22, 2013 20:30 |
|
When I do gem server and then go to http://localhost:8808 I see rails 3.2.11 listed, but when I type rails in the command line, it says -bash: rails: command not found. What can I do to fix this. I'm new to ruby, but have a lot of python experience. I'm using OSX Lion, and installed ruby via homebrew. I tried uninstalling ruby, then re-installing, but that had no effect.
|
# ? Jan 22, 2013 22:52 |
|
Not sure how homebrew ruby adds executables from gems- have you considered rbenv?
|
# ? Jan 22, 2013 23:00 |
|
how!! posted:When I do gem server and then go to http://localhost:8808 I see rails 3.2.11 listed, but when I type rails in the command line, it says -bash: rails: command not found. What can I do to fix this. I'm new to ruby, but have a lot of python experience. I'm using OSX Lion, and installed ruby via homebrew. I tried uninstalling ruby, then re-installing, but that had no effect. Yes, but how did you install rails? You know rails is not the same thing as ruby, right?
|
# ? Jan 22, 2013 23:29 |
|
how!! posted:When I do gem server and then go to http://localhost:8808 I see rails 3.2.11 listed, but when I type rails in the command line, it says -bash: rails: command not found. What can I do to fix this. I'm new to ruby, but have a lot of python experience. I'm using OSX Lion, and installed ruby via homebrew. I tried uninstalling ruby, then re-installing, but that had no effect. According to the Homebrew wiki your rails executable may be in ~/.gems/bin; make sure that's in your PATH. You might consider putting code:
Or use rvm/rbenv/chruby/whatever.
|
# ? Jan 23, 2013 02:32 |
|
I've been going through the book Ruby on Rails Tutorial, and after running into trouble with my .css file not being uploaded, decided to update Ruby and Rails. Well, now when I run 'rails server' I get an error: C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in 'require': cannot load such file -- sqlite3 <LoadError> That's followed by a long trace to 'from script/rails:6: in <main>. It's something that happened by updating, because I can get a new program up and running easily. Any ideas?
|
# ? Jan 23, 2013 02:49 |
|
Coco13 posted:I've been going through the book Ruby on Rails Tutorial, and after running into trouble with my .css file not being uploaded, decided to update Ruby and Rails. Well, now when I run 'rails server' I get an error: Try doing bundle install It will install all the gems you need for your project. You may have to install bundler again though, that's gem install bundler
|
# ? Jan 23, 2013 06:44 |
|
Ruby code:
|
# ? Jan 23, 2013 21:21 |
|
Physical posted:
Ruby code:
Ruby code:
So when inside a method instead of self.method('block') its doing super.method("block") Kallikrates fucked around with this message at 22:10 on Jan 23, 2013 |
# ? Jan 23, 2013 22:06 |
|
Thanks but where do I find some official documentation on that stuff. Do both the scopes get executed simultaneously? I am probably way off, but I don't know what to call this when I check the ruby and rails docs.
|
# ? Jan 23, 2013 22:12 |
|
Blocks and inheritance are ruby; not rails. So any references strictly related to ruby would be a good place to look. http://www.ruby-doc.org/docs/ProgrammingRuby/
|
# ? Jan 23, 2013 22:18 |
|
How do var1 and var2 get used in the block? For context, this is for a def create/update in a controller using inherited resources. e: Maybe the code I am looking at was written wrong. I found this example Ruby code:
ee: It talks about it more here https://github.com/josevalim/inherited_resources Sorry for bugging you guys. eee: One question still remains, why the .html part? Why can't it just be Ruby code:
Physical fucked around with this message at 22:34 on Jan 23, 2013 |
# ? Jan 23, 2013 22:24 |
|
That depends on the methods implementation, For example Hash#each accepts a block that is called on each |key,value| pair. Enumerable#inject accepts a block that is called for each object in an enumerable on an accumulator: |memo, object| I looked up ActiveRecords::Base create and update and they don't look like what you are talking about. with respect to success and failure
|
# ? Jan 23, 2013 22:35 |
|
Pardot posted:Try doing bundle install Worked like a champ, thanks!
|
# ? Jan 24, 2013 01:36 |
|
Two somewhat related questions: So the @ symbol means a var is scoped within a model/object, correct? So this means that using @ in a controller doesn't really do anything? Second: It seems like the same scoping applies to helpers. How to helpers work exactly and what is the best practice with them? I realize you have to require them by your controllers in order to make use of them -- does that mean it's generally bad practice to use a helper within a controller? I'm just really confused about what should be in a helper and what should be in a model. I've always read "skinny controllers, fat models," but in the tutorial I went through, the practice seemed to be "skinny controllers, skinny models, fat helpers."
|
# ? Jan 24, 2013 07:03 |
|
chumpchous posted:Two somewhat related questions: The @ sigil scopes a variable to an instance. Models are usually instances, and so are controllers. During a rails request, you only ever deal with one controller anyways. Helpers are mixed in to controllers. They have access to a controller's instance variables. Views also run in the scope of a controller. They have acces to the controller's instance variables. Not every tutorial is equally good.
|
# ? Jan 24, 2013 14:10 |
|
edit: ignore this
Into The Mild fucked around with this message at 01:29 on Jan 26, 2013 |
# ? Jan 25, 2013 23:27 |
|
Hoollyyyy poo poo learning rails from having no programming experience is overwhelming. I'm coaching a RailsGirls event today, and I can't believe how many different things you have to know.
|
# ? Jan 26, 2013 23:36 |
|
Yeah, which is why somewhat skeptical of the concept. Teaching programming is hard enough already, but when the first thing you show them is a big, complex framework like Rails, it's a lot of things to learn at once.
|
# ? Jan 26, 2013 23:56 |
|
Pardot posted:Hoollyyyy poo poo learning rails from having no programming experience is overwhelming. I'm coaching a RailsGirls event today, and I can't believe how many different things you have to know. I'm currently teaching a 3 month course for people who have never programmed before, and holy poo poo yes. Our second class was just an overview of what MVC is and where all the various bits fit in, and I think half of the classes eyes were bleeding at the end. quote:Yeah, which is why somewhat skeptical of the concept. Teaching programming is hard enough already, but when the first thing you show them is a big, complex framework like Rails, it's a lot of things to learn at once. We've taken the approach of mixing together teaching Ruby and Rails. Every class has like an hour of Ruby stuff, just enough to teach what you're going to learn on the rails side, and then dig into it with Rails examples. For instance, for our models class, we'll spend an hour going over classes, methods, variables, symbols, hashes, and arrays, and then applying them in making a model (which you don't really NEED stuff like blocks, looping, even conditionals for the most basic models. Then something like controllers would introduce blocks (to explain respond_to), and conditionals (which you pretty much need in an update method). I find starting 100% with Ruby just gets people frustrated that they're not actually making something useful. Plus if you're just going with pure Ruby, people won't be motivated to experiment with stuff outside of direct exercises you give them. Another good thing we've found is to "reset" the project once in a while, or have a few projects to work on, where you can start off fairly sloppy but get to nice, TDD, well structured code by the end. Our first "project" was 100% scaffolded, where people literally didn't modify code outside of "rails generate". The second wasn't TDDed, and was really basic in structure. The third is going to be fully tested from the start. enki42 fucked around with this message at 00:39 on Jan 27, 2013 |
# ? Jan 27, 2013 00:36 |
|
Pardot posted:Hoollyyyy poo poo learning rails from having no programming experience is overwhelming. I'm coaching a RailsGirls event today, and I can't believe how many different things you have to know. This sounds like teaching Linear Algebra before someone's taken Algebra I and II.
|
# ? Jan 28, 2013 04:08 |
|
Dangerllama posted:This sounds like teaching Linear Algebra before someone's taken Algebra I and II. So the point wasn't really to give people complete understanding in one day, just to spark excitement in building a web app and getting it running.
|
# ? Jan 28, 2013 04:11 |
|
Dangerllama posted:This sounds like teaching Linear Algebra before someone's taken Algebra I and II. No kidding. Pardot - do yourself a favour and put Rails aside until you're comfortable with Ruby and universal programming constructs such as looping, objects, etc. I'm an experienced software engineer and I find Rails to be a big beast to handle at times.
|
# ? Jan 28, 2013 04:11 |
|
enki42 posted:I find starting 100% with Ruby just gets people frustrated that they're not actually making something useful. Plus if you're just going with pure Ruby, people won't be motivated to experiment with stuff outside of direct exercises you give them. Devil's advocate: Why not base a course off something like projecteuler.net (or equivalent - adjust for your audience's interests)? I find that people are surprisingly intrigued to find out that programming opens up a whole world of problem solving that was previously inaccessible.
|
# ? Jan 28, 2013 04:14 |
|
Pardot posted:So the point wasn't really to give people complete understanding in one day, just to spark excitement in building a web app and getting it running. So maybe Sinatra? Ninja edit: I understand what you're saying. Learning programming principles doesn't really get the old juices flowing past the age of 20-something. People want to see the fruits of their labors rather than, "Oh hey, look...I just printed out a fibonacci sequence. " Just sounds like you might have the opposite problem with Rails. Not just folks not getting the framework, but folks not having enough time to soak up the foundations they're going to have to grok in order to move forward afterword. waffle enthusiast fucked around with this message at 04:24 on Jan 28, 2013 |
# ? Jan 28, 2013 04:22 |
|
Lexicon posted:No kidding. Pardot - do yourself a favour and put Rails aside until you're comfortable with Ruby and universal programming constructs such as looping, objects, etc. I'm an experienced software engineer and I find Rails to be a big beast to handle at times. I want to quote this to keep it around.
|
# ? Jan 28, 2013 04:25 |
|
Dangerllama posted:So maybe Sinatra? Yeah I agree. I told the organizers that that might have been a better starting point for next time. Having everything in one file would have been much easier I think, than having to learn some of the shell + starting/stopping rails + rails generators + migrate + css + gems + html + erb + etc etc. Sinatra wouldn't cut down on that list that much, but even a little would help. It was really awesome that by the end of the day they could share the app with their friends after pushing it live. I was super impressed at how far they were able to get. edit: The Journey Fraternity posted:I want to quote this to keep it around. Heh, to be fair though I can see how you could misinterpret what I posted without context.
|
# ? Jan 28, 2013 04:26 |
|
I wonder if some simple visual-ish programming tool would be a better choice. Maybe something like what Resig & Khan Academy are doing. http://www.khanacademy.org/cs/intro-to-variables/825241936
|
# ? Jan 28, 2013 04:42 |
|
Anyone here gonna be at Heroku's Waza next month?
|
# ? Jan 28, 2013 06:32 |
|
I learned how to use Ruby and Rails simultaneously. I kind of regret that now and wish I'd learned Ruby first. It's a spectacular language but often when I use it I mix up what is just Ruby and what is Rails.
|
# ? Jan 28, 2013 15:12 |
|
Lexicon posted:Devil's advocate: Why not base a course off something like projecteuler.net (or equivalent - adjust for your audience's interests)? I find that people are surprisingly intrigued to find out that programming opens up a whole world of problem solving that was previously inaccessible. The short answer is that we've tried this, and ultimately it does end up a bit frustrating for people to not be able to "do anything" with the programming knowledge they've learned over the course of a lesson. I think there's a couple of extremes here - I don't think anyone would argue that you shouldn't dive straight into Rails with absolutely no understanding of Ruby, and also that you don't have to know the language inside and out before you're even allowed to touch Rails. For us, calling out Ruby seperately and introducing concepts a little at a time, and tying them to practical examples has been extremely helpful. quote:It was really awesome that by the end of the day they could share the app with their friends after pushing it live. I was super impressed at how far they were able to get. This is basically the reason that we went with. When we ran pure Ruby workshops, people were excited but a little frustrated that they hadn't really "made" something. When we ran a course that started with something as basic as just scaffolding out a project, people were way more excited, even if they didn't understand everything that was happening. Sinatra is kind of a weird case - on one hand, it's REALLY easy to get something incredibly basic up. On the other hand, once you start to extend that beyond basic applications, you hit a bit of a wall where you need to understand how a lot of stuff works and how to best structure an application. I kind of disagree with the idea that Sinatra is a good tool to teach new programmers beyond the most basic "Hello World" sites.
|
# ? Jan 28, 2013 17:27 |
|
Whenever someone wants me to teach them programming from zero knowledge I follow this list: 1)Entry point (everything's got one, somewhere. Sometimes it's better to just accept it on faith) 2)Loops 3)The main loop ("do forever while user doesn't exit") 4)Cooler versions of loops (for each, .each, etc) Then after that I get into functions and classes. Variables are handled along the way. But the entry point and loops is the one I think helps the most. Everything started from there.
|
# ? Jan 28, 2013 17:35 |
|
The funny thing about teaching Ruby from a rails concept is that a lot of those assumptions don't really apply though. 1. There isn't an "entry point" for a typical Rails application. I mean, obviously there is, but it's not something that you really need to know about off the bat, and thinking of a Rails app in terms of a normal procedural program can be confusing for newbies. The "main loop" is even more obscured and isn't something any Rails user is likely to encounter pretty much ever (seeing as it isn't even really in Rails per se) 2. You can actually go a long way without loops in Rails, but it does demand that you know some other programming concepts before that. Here's what we do: Models - Learn classes, methods, arrays, hashes, variable scoping Controllers - Learn conditionals, boolean logic Views - Learn loops (to deal with the .each that you're going to have in your index view), talk about blocks a bit.
|
# ? Jan 28, 2013 18:23 |
|
I can't imagine being a "new person" and not falling asleep through all of that. MVC would be day two, I at least have to explain to people that somewhere there is an entry loop, otherwise they think "magic" and that doesn't really lead to good programmers.
|
# ? Jan 28, 2013 18:29 |
|
What I like to do teaching ruby is make a little game in a couple of hours that lets users work with main loop, input, output and some simple logic. I actually used both classes and testing in my game, but you can just do methods to keep it simple. Last time i did the hangman game and it was fairly fun to implement and play with afterwards. Then next lesson you can convert it to rails version and show that main loop => rails server, input => routes, output => views, controller + model => logic.
|
# ? Jan 28, 2013 19:39 |
|
tima posted:What I like to do teaching ruby is make a little game in a couple of hours that lets users work with main loop, input, output and some simple logic. I actually used both classes and testing in my game, but you can just do methods to keep it simple. Last time i did the hangman game and it was fairly fun to implement and play with afterwards.
|
# ? Jan 28, 2013 20:01 |
|
|
# ? May 15, 2024 02:35 |
|
Using Devise? Patch it. Sounds like this is another drop what you're doing and get on it sort of patch. http://blog.plataformatec.com.br/2013/01/security-announcement-devise-v2-2-3-v2-1-3-v2-0-5-and-v1-5-3-released/
|
# ? Jan 28, 2013 21:27 |