|
Rails for Zombies was interesting, but it has nothing on going through Michael Hartl's online book and building a full app yourself. It really hits on testing ALOT, which might be a hurdle you don't want to mess with, but it was definitely a great jumping off point for me learning Ruby AND Rails from scratch. http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
|
# ? Jun 21, 2013 16:15 |
|
|
# ? May 15, 2024 04:13 |
|
A bit late to the party, but realistically speaking I am looking for a career change. I have some programming experience from HS, but opted for a stupid Liberal Arts Degree that has offered dismal opportunities. What would I have to do to be taken serious when I start to look for a job? or Should I not even bother at this point?
|
# ? Jun 21, 2013 16:31 |
|
shdwdmg posted:What would I have to do to be taken serious when I start to look for a job? or Should I not even bother at this point? Having an awesome portfolio and being good at networking will be enough.
|
# ? Jun 21, 2013 16:35 |
|
shdwdmg posted:A bit late to the party, but realistically speaking I am looking for a career change. I have some programming experience from HS, but opted for a stupid Liberal Arts Degree that has offered dismal opportunities. Learn enough Rails to build some apps, be able to be confident and friendly in an interview, and be willing to relocate. I know a few shops in Miami that are desperate to hire, and my understanding is that places in NYC, SF, Chicago, etc. are also having trouble finding enough developers.
|
# ? Jun 21, 2013 17:55 |
|
Cocoa Crispies posted:Learn enough Rails to build some apps, be able to be confident and friendly in an interview, and be willing to relocate. I know a few shops in Miami that are desperate to hire, and my understanding is that places in NYC, SF, Chicago, etc. are also having trouble finding enough developers. I am in the Chicago suburbs, so this seems promising.
|
# ? Jun 21, 2013 19:00 |
|
Cocoa Crispies posted:I did this with non-programmers. cool thanks. yeah, planning on recommending sublime text and setting up a vagrant box to have people boot up. shdwdmg posted:A bit late to the party, but realistically speaking I am looking for a career change. I have some programming experience from HS, but opted for a stupid Liberal Arts Degree that has offered dismal opportunities. Attend meetups and share any for fun projects you do =)
|
# ? Jun 21, 2013 21:09 |
|
shdwdmg posted:A bit late to the party, but realistically speaking I am looking for a career change. I have some programming experience from HS, but opted for a stupid Liberal Arts Degree that has offered dismal opportunities.
|
# ? Jun 21, 2013 22:25 |
|
shdwdmg posted:A bit late to the party, but realistically speaking I am looking for a career change. I have some programming experience from HS, but opted for a stupid Liberal Arts Degree that has offered dismal opportunities. Look for a local Ruby or Rails user group -- I organize the MN Ruby user group, and it's an awesome way to learn and network with people.
|
# ? Jun 23, 2013 19:30 |
|
manero posted:Look for a local Ruby or Rails user group -- I organize the MN Ruby user group, and it's an awesome way to learn and network with people. This is a good idea. I know Austin has one that is filled with companies looking for Rails people. They do monthly meetings with two presentations where the first is geared toward rails beginners.
|
# ? Jun 23, 2013 21:56 |
|
Can anyone offer suggestions on how I should be using CanCan to control permissions for records that are related to parent records? For example, I have a Book model which I can enforce :manage permissions on based on an author.id I have in my sessions (via Devise). I know there's a few ways to go about it, but my current ability.rb for CanCan looks like:code:
code:
EDIT: I also tried using this method in my applicable app controllers: code:
|
# ? Jun 25, 2013 00:18 |
|
mmachine posted:So question is, how do I get the Book CanCan permissions defined already in my ability.rb to descend to child record(s) of the Book model? CanCan documentation reads like this should happen based on my native model definitions for the app, but that doesn't seem to be the case. Do I also need to define relationships within CanCan's Ability model or what? If so, is there a decent example someone can provide? How are you assigning to the pages class? If you aren't assigning via the book class, then it probably won't pick up the CanCan ability. I'm not sure if just doing book.pages.create will be enough to assign through books.
|
# ? Jun 25, 2013 02:15 |
|
kayakyakr posted:How are you assigning to the pages class? If you aren't assigning via the book class, then it probably won't pick up the CanCan ability. I'm not sure if just doing book.pages.create will be enough to assign through books. I'm assigning page classes for my application via the core model definitions for my app. That relationship has been in place for a while now, and works no problem. The CanCan implementation is pretty recent, which is why I'm kind of confused as to where I'm not re-affirming these relationships for CanCan. When you say assign via the book class, do you mean via a CanCan-specific method?
|
# ? Jun 25, 2013 12:22 |
|
mmachine posted:I'm assigning page classes for my application via the core model definitions for my app. That relationship has been in place for a while now, and works no problem. The CanCan implementation is pretty recent, which is why I'm kind of confused as to where I'm not re-affirming these relationships for CanCan. Sorry, I was wrong on how CanCan is implemented. New set of questions about your implementation: Are you using shallow routes (/pages/:id) or deep routes (/books/:book_id/pages/:id)? Outside of the load_and_authorize_resource block, how are you using CanCan? One note in my searches that I ran across: to use load_and_authorize, CanCan needs some sort of searching done on its ability. Your ability file could theoretically be designed as code:
|
# ? Jun 25, 2013 14:18 |
|
kayakyakr posted:Sorry, I was wrong on how CanCan is implemented. New set of questions about your implementation: Oh no worries. I am using deep / nested resource routes. Goes a little like you described: code:
code:
code:
code:
EDIT: So I think I figured this out, but it feels kind of awkward because I had to hop back from the child record to reference the parent. Like so: code:
In any case, with my own personal QA it looks like the child records now follow ownership of their parents. Can anyone weigh in on whether or not I'm on the right track? mmachine fucked around with this message at 17:41 on Jun 25, 2013 |
# ? Jun 25, 2013 14:39 |
|
That's how you do it. I've recently upgraded our file with a similar parent chaining with added consideration if the parent isn't attached yet.
|
# ? Jun 26, 2013 21:00 |
|
I'm doing QA for a small company and I'm trying to modify their test infrastructure so it doesn't need to touch an actual database and do real database operations. I spent all day trying to get NullDB to work but I'm terrible with, like, config files and stuff. Is there any nice way I can tell Rails to not actually save the variables to the hard disk? And instead have a bunch of variables floating around that are basically like database objects but they get garbage-collected when they fall out of scope? Because that would be, like, the ideal scenario. Not going around and rewriting every single test and instead putting some code in there saying "when I say Lesson.create I ACTUALLY mean Lesson.mostly-create-but-not-save-because-like-seriously-it-is-unnecessary-to-go-to-the-database" I'm mostly trying to avoid spending an entire day doing that again D:
|
# ? Jun 27, 2013 07:04 |
|
it is posted:I'm doing QA for a small company and I'm trying to modify their test infrastructure so it doesn't need to touch an actual database and do real database operations. I spent all day trying to get NullDB to work but I'm terrible with, like, config files and stuff. Is there any nice way I can tell Rails to not actually save the variables to the hard disk? And instead have a bunch of variables floating around that are basically like database objects but they get garbage-collected when they fall out of scope? Because that would be, like, the ideal scenario. Not going around and rewriting every single test and instead putting some code in there saying "when I say Lesson.create I ACTUALLY mean Lesson.mostly-create-but-not-save-because-like-seriously-it-is-unnecessary-to-go-to-the-database" I don't have a solution for not writing to the DB at all, but if your queries are standard AR stuff then SQLite supports running a database in memory. Just use "memory" as the database location in your config.
|
# ? Jun 27, 2013 13:34 |
|
I have two objects/tables, Persons and feed_entries. A person can have multiple feed_entries. I want to set the default_scope for Persons so that it orders DESC by the "last_updated" method which is defined below on person.rbRuby code:
Ruby code:
Ruby code:
KoRMaK fucked around with this message at 22:48 on Jun 27, 2013 |
# ? Jun 27, 2013 20:46 |
|
KoRMaK posted:I have two objects/tables, Persons and feed_entries. A person can have multiple feed_entries. I want to set the default_scope for Persons so that it orders DESC by the "last_updated" method which is defined below on person.rb last_updated is on the Ruby class, not the SQL table.
|
# ? Jun 27, 2013 22:14 |
|
This would probably work if you wanted to do that ordering by a scope:code:
It sounds like what you're really trying to accomplish is to have the rules for when a person is updated include whether they have had a feed entry created. It might just be simpler to change the person's updated_at when the feed entry is created and avoid all this crazy joining in the first place: code:
|
# ? Jun 28, 2013 11:49 |
|
You can do that right in the relationship.code:
|
# ? Jun 28, 2013 13:46 |
|
Yes that makes so much sense. Way more rails than whatever I was envisioning.
|
# ? Jun 28, 2013 13:50 |
|
Has anyone had to deal with devise's password reset in a multi tenantcy environment? Devise is only looking for users by email, I need email and account_id in my user load query. I'm going through the devise library and feels like I'm getting close but there has got to be someone else that has had this issue. I'm currently overriding the devise password controllers create method but by the time it gets to user.find first by auth conditions it has forgotten the account id I am passing in.
|
# ? Jun 28, 2013 21:31 |
|
How'd you set Devise up in your initializer? If you haven't already tweaked your config.authentication_keys and config.request_keys, start there and the rest should fall into place a lot more quickly and obviously.
|
# ? Jun 28, 2013 22:11 |
|
Molten Llama posted:How'd you set Devise up in your initializer? If you haven't already tweaked your config.authentication_keys and config.request_keys, start there and the rest should fall into place a lot more quickly and obviously.
|
# ? Jun 28, 2013 22:26 |
|
Given an exported GPG private key and its passphrase, how can I decrypt a string encrypted with the corresponding public key? Haven't had any luck with GPG-related gems, which all seem to rely on pinentry/gpg-agent instead of a provided passphrase.
|
# ? Jul 7, 2013 20:57 |
|
xtal posted:Given an exported GPG private key and its passphrase, how can I decrypt a string encrypted with the corresponding public key? Haven't had any luck with GPG-related gems, which all seem to rely on pinentry/gpg-agent instead of a provided passphrase. I don't know how deep you want to dig into it, but PGP/GPG uses https://tools.ietf.org/html/rfc4880 for algorithm, it should be fairly easy to implement (code wise) if you have time to dig into the math. That said this gem looks like it doesn't have too many dependencies, although I haven't used it myself: http://openpgp.rubyforge.org/
|
# ? Jul 8, 2013 01:10 |
|
xtal posted:Given an exported GPG private key and its passphrase, how can I decrypt a string encrypted with the corresponding public key? Haven't had any luck with GPG-related gems, which all seem to rely on pinentry/gpg-agent instead of a provided passphrase. Install GPG, spawn it with the passphrase being echo'd in. The GPG gems are all pretty much garbage. tima posted:I don't know how deep you want to dig into it, but PGP/GPG uses https://tools.ietf.org/html/rfc4880 for algorithm, it should be fairly easy to implement (code wise) if you have time to dig into the math. DO NOT under any circumstances do this. You'll gently caress it up in an unintuitive way and waste a lot of time in the process.
|
# ? Jul 8, 2013 03:24 |
|
Installing GPG is fine, but I'd like to do it without needing to --import the key or deal with pinentry. Suppose this is more of a GPG question than a Ruby question now, though.
xtal fucked around with this message at 02:35 on Jul 9, 2013 |
# ? Jul 8, 2013 12:57 |
|
I hate timezones... anyways.. Am i doing something wrong with this? Ruby code:
Ruby code:
edit: I'm guessing timezone lookup is done using standard offset, whereas the 240 minutes comes from javascript (new Date()).getTimezoneOffset() (which is affected by daylight savings) soullessshoe fucked around with this message at 16:39 on Jul 9, 2013 |
# ? Jul 9, 2013 16:37 |
|
Time Zones in any language are a huge pain in the rear end. If you have a particular zone you want the time in, you can use code:
|
# ? Jul 9, 2013 21:17 |
|
A good read is The Exhaustive Guide to Rails Time Zones
|
# ? Jul 9, 2013 21:26 |
|
Timezone chat: The default datatype rails uses for timestamps is `timestamp` which is terrible. You should always use `timestamptz` Here is an example migration that will fix the awful code:
|
# ? Jul 9, 2013 21:39 |
|
Regarding the timezones: the offset is coming from client side, being saved to a cookie, then read server-side. problem is that the current offset is passed from client side whereas ActiveSupport::TImeZone#[] does the lookup by standard timezone offset. Hence the reason I am doing the crazy Ruby code:
|
# ? Jul 9, 2013 21:55 |
|
soullessshoe posted:Regarding the timezones: the offset is coming from client side, being saved to a cookie, then read server-side. Ok, so my understanding might be too simple, but how about outputting date to string, parsing it server side, and taking what you get in ruby? With some manipulation it would give you the right zone without worrying about DST. JS: code:
code:
|
# ? Jul 9, 2013 23:56 |
|
I am a newbie and stuck trying to get nested resources and associations to work. I used scaffolding to generate my DB migrations, controller, routes, and views for a training app that I am working on to help myself get comfortable with rails. I nested my resources in routes.rb:code:
athlete.rb code:
code:
code:
No route matches [POST] "/athletes/1/training_plans/new" These are my rake routes: (screen shot to save tables) And here is my training_plans_controller.rb file: code:
Newbsylberry fucked around with this message at 20:08 on Jul 10, 2013 |
# ? Jul 10, 2013 19:45 |
|
New is a view-only route. The create is triggered by POSTing the index route, ie athlete_training_plans_path. The route helper you should be using shows on the left side of the route output and is the last one listed above. Create (POST) is athlete_training_plans, Update (PUT) and destroy (DELETE) are both on athlete_training_plan. New and Edit just get the forms, you don't post back to them.
|
# ? Jul 10, 2013 21:19 |
|
Can anyone point me towards some good resources for Chef recipes?
|
# ? Jul 11, 2013 22:13 |
|
We watched a peepcode screencast about chef at work, it was pretty decent.
|
# ? Jul 11, 2013 22:41 |
|
|
# ? May 15, 2024 04:13 |
|
Lexicon posted:Can anyone point me towards some good resources for Chef recipes? I think the opscode site has some pretty good resources itself. Just curious - any reason you picked chef over puppet?
|
# ? Jul 11, 2013 22:58 |