|
A MIRACLE posted:Read/Write Purple, Read-only White Ah, no I meant the type of database mecha, ika, etc. The colors are just randomly assigned on provisioning so that you can have more than one db per app.
|
# ? Apr 23, 2014 16:31 |
|
|
# ? May 15, 2024 03:01 |
sorry it's early for me. they're both "Ika"
|
|
# ? Apr 23, 2014 16:35 |
|
Is there a way to make a two sided polymorphic join table? The join table would be: object_id object_type related_item_id related_item_type
|
# ? Apr 24, 2014 21:11 |
KoRMaK posted:Is there a way to make a two sided polymorphic join table? Would be easy enough with custom queries and a manager. Idk if activerecord supports it though.
|
|
# ? Apr 24, 2014 21:50 |
|
Oh, derp, I can probably get this done with using as: on the object side. I've figured something similar to this out before, it's just a little hazy remembering the nuances of the has many options. The one I always forge is that as defines the column name you want the current object to masquarde as.
|
# ? Apr 24, 2014 22:51 |
|
Is there a good gem for users to create events and invite people? With security options like public, private, etc?
|
# ? Apr 25, 2014 17:08 |
|
I'm fairly new to Rails and I'm trying to use it to make a web-based wargame. I was building a database to represent all of the countries (board spaces if this were a real game) with columns for each of the things a country has - player1 troops, player2 troops, and so on, with the idea that playing the game would be the machine updating each of those columns as the board state changes. However, I realized as I started doing it that this would mean the database would be constantly changing, so there couldn't be multiple games. So now I'm thinking that each game would begin with creating a new database "foo" from template "bar" where foo is an automatically sequencing number(ie, game000001, game000002, etc) and bar is the original database. However, this is a little out of my comfort zone and I don't know if that's a good idea or if there's a better way, and Google isn't turning up anything helpful. Is this a sane way to approach the problem? (Obviously I would need to have the server clean itself up periodically since I don't want scads of completed/zombie game databases laying around.)
|
# ? May 1, 2014 04:15 |
|
Tao Jones posted:I'm fairly new to Rails and I'm trying to use it to make a web-based wargame. I was building a database to represent all of the countries (board spaces if this were a real game) with columns for each of the things a country has - player1 troops, player2 troops, and so on, with the idea that playing the game would be the machine updating each of those columns as the board state changes. That's a horrible way to design this. Horrible. Create a Game table. Link that to a Competitor table. Have a Pieces or Troops or whatever table that tracks what forces the competitor has and where they are located. Use indexes to keep it all fast. Game has many competitors Competitors has many troops etc etc. e: Or just do it all in a document database where each game is one whole document which would work if the size was limited. Could do this with postgres and json fields too. kayakyakr fucked around with this message at 06:55 on May 1, 2014 |
# ? May 1, 2014 06:53 |
|
kayakyakr posted:That's a horrible way to design this. Horrible. Thanks, that's helpful. I got hung up thinking that there should be a Countries table that keeps track of who has what where, but thinking about it in the way you suggest makes a lot of sense.
|
# ? May 1, 2014 07:37 |
|
Tao Jones posted:Thanks, that's helpful. I got hung up thinking that there should be a Countries table that keeps track of who has what where, but thinking about it in the way you suggest makes a lot of sense. There could be a countries table, but it'd be linked to the game table and would be linked to by the troops table.
|
# ? May 1, 2014 15:26 |
|
I have a custom getter/setter that I want to run through validator using validates :field, :format => {my_options} But the statement seems to ignore the validator. Is there a way to bridge the built-in validates feature with my own custom getter/setter?
|
# ? May 1, 2014 16:54 |
|
KoRMaK posted:I have a custom getter/setter that I want to run through validator using validate :my_custom_validation_method ?
|
# ? May 1, 2014 20:29 |
|
Took me literally 10 hours to figure out how to clean install Ruby on Rails, Git, and Heroku on Ubuntu. The learning curve apparently starts before you even get your environment setup. There's just too many outdated guides and poo poo, I may be a retard but I feel like it should be easier to setup.
|
# ? May 1, 2014 22:58 |
|
fruition posted:Took me literally 10 hours to figure out how to clean install Ruby on Rails, Git, and Heroku on Ubuntu. The learning curve apparently starts before you even get your environment setup. There's just too many outdated guides and poo poo, I may be a retard but I feel like it should be easier to setup. code:
|
# ? May 1, 2014 23:28 |
|
http://www.railstutorial.org/ I used this one, it's pretty up to date.
|
# ? May 2, 2014 10:52 |
|
fruition posted:Took me literally 10 hours to figure out how to clean install Ruby on Rails, Git, and Heroku on Ubuntu. The learning curve apparently starts before you even get your environment setup. There's just too many outdated guides and poo poo, I may be a retard but I feel like it should be easier to setup.
|
# ? May 2, 2014 14:21 |
|
fruition posted:Took me literally 10 hours to figure out how to clean install Ruby on Rails, Git, and Heroku on Ubuntu. The learning curve apparently starts before you even get your environment setup. There's just too many outdated guides and poo poo, I may be a retard but I feel like it should be easier to setup. Dude, this is nothing compared to the Java/Struts/Spring/whatever the gently caress else days of yore (uphill both ways, etc). It probably could be easier, but this is all fairly complex computing machinery.
|
# ? May 2, 2014 14:57 |
kayakyakr posted:
rvm is poo poo and you should be using rbenv + ruby-build
|
|
# ? May 2, 2014 16:56 |
|
double sulk posted:rvm is poo poo and you should be using rbenv + ruby-build Serves my purpose and seems to have a shorter setup time than rbenv, so I'll use it until it no longer works for me.
|
# ? May 2, 2014 17:18 |
|
kayakyakr posted:Serves my purpose and seems to have a shorter setup time than rbenv, so I'll use it until it no longer works for me. Are you using homebrew? As I recall, rbenv was an absolute breeze to install with that. It really is the better option, but I guess stick with rvm if you must.
|
# ? May 2, 2014 17:24 |
kayakyakr posted:Serves my purpose and seems to have a shorter setup time than rbenv, so I'll use it until it no longer works for me. Lexicon posted:Are you using homebrew? As I recall, rbenv was an absolute breeze to install with that. It really is the better option, but I guess stick with rvm if you must. brew install rbenv ruby-build echo 'eval "$(rbenv init -)"' >> ~/.bash_profile rbenv install 2.1.1 rbenv global 2.1.1 It's literally four lines on OS X and you can install every version you want and it isn't the gigantic clusterfuck that rvm is.
|
|
# ? May 2, 2014 17:32 |
|
He's on Ubuntu, but that doesn't mean he isn't terribly terribly wrong about his choice of version management.
|
# ? May 2, 2014 17:34 |
|
Gmaz posted:http://www.railstutorial.org/ Yeah this is what I used to get a working setup. I must say I'm liking Rails so far and it's great to have a reason to learn Linux finally.
|
# ? May 2, 2014 19:14 |
|
In a view, I'm doing some cachingRuby code:
|
# ? May 2, 2014 21:02 |
|
Lexicon posted:Dude, this is nothing compared to the Java/Struts/Spring/whatever the gently caress else days of yore (uphill both ways, etc). I don't think that's fair, I set up Java for development in 15 minutes and 10 of it was downloading packages because I haven't ever had anything Java on my computer. It's not hard to set up a development environment in either language anymore.
|
# ? May 4, 2014 15:40 |
|
xtal posted:I don't think that's fair, I set up Java for development in 15 minutes and 10 of it was downloading packages because I haven't ever had anything Java on my computer. It's not hard to set up a development environment in either language anymore. Yeah, I haven't touched Java in about half a decade so I'm not surprised that isn't accurate. Respectfully withdrawn
|
# ? May 4, 2014 16:28 |
|
I feel like I should know the answer to this, but apparently don't: is it possible to rely exclusively on 'bundler' for gem installation? I'm about to start using middleman for static site generation, and all the tutorials are requiring that I 'gem install middleman' first, despite referencing bundler later. Can I not just structure things so only bundler installs the gem? Or is that not feasible because the 'middleman' command needs to be available in the terminal?
|
# ? May 4, 2014 16:33 |
|
KoRMaK posted:In a view, I'm doing some caching
|
# ? May 4, 2014 16:51 |
|
Lexicon posted:I feel like I should know the answer to this, but apparently don't: is it possible to rely exclusively on 'bundler' for gem installation? I'm about to start using middleman for static site generation, and all the tutorials are requiring that I 'gem install middleman' first, despite referencing bundler later. Can I not just structure things so only bundler installs the gem? Or is that not feasible because the 'middleman' command needs to be available in the terminal? Yes, you can just let bundler handle all the gem installation. The only downside is that you might have to preface your middleman calls with "bundle exec". Bundler doesn't strictly sandbox gems like using gemsets, or python's virtualenv. Think of it as a filter on the larger pool of gems that you have installed, making sure that only the ones you've specified are activated.
|
# ? May 4, 2014 17:06 |
|
Sailor_Spoon posted:Yes, you can just let bundler handle all the gem installation. The only downside is that you might have to preface your middleman calls with "bundle exec". Perfect - thanks. This worked beautifully.
|
# ? May 4, 2014 18:20 |
|
Sailor_Spoon posted:Yes, you can just let bundler handle all the gem installation. The only downside is that you might have to preface your middleman calls with "bundle exec". If you use binstubs, you won't need to use bundle exec. And if you use the --path option, you can install them in your vendor/ruby (or any other) folder and not globally. The only non-default gem I have installed globally is bundler.
|
# ? May 4, 2014 22:11 |
|
I'm reading about Vagrant and in their docs they docode:
OK, never mind I tracked it down via google. It's just a different type of string literal. For some reason searcing ruby-doc.org for << doesn't find anything.
|
# ? May 7, 2014 20:22 |
|
Sil posted:I'm reading about Vagrant and in their docs they do Ruby doesn't have triple-quote literals in the sense that Python does. It just concatenates two adjacent string literals together implicitly. """something"""" is just "" + "something" + "".
|
# ? May 7, 2014 22:33 |
|
Sil posted:I'm reading about Vagrant and in their docs they do It's called a HEREDOC. It's a Perl thing.
|
# ? May 7, 2014 23:49 |
|
Arachnamus posted:It's called a HEREDOC. It's a Perl thing. sh thing originally.
|
# ? May 8, 2014 07:08 |
|
Smol posted:sh thing originally. I know But let's be honest it's a Perl thing, like so many of the dark corners of Ruby (like all that horrible File shite).
|
# ? May 8, 2014 08:26 |
|
Arachnamus posted:It's called a HEREDOC. It's a Perl thing. Yeah I read a bit of that link I added and then stopped when I saw that it goes. On. For. Pages. It's like an entire DSL tied to one freaking operator Wait. Where did I pick up that """ """ thing? It must have been some rails tutorial book, but I could have sworn they said that's the way to do multiline strings in ruby. I see now, in IRB, that regular string literals do that just fine.
|
# ? May 8, 2014 12:47 |
|
Can anyone help me with nested forms? I have a user model (generated by devise with some additional attributes) that has and belongs to many languages. They have their join table in the schema and everything works correctly in that regard. But how do I create a view that will allow the person to edit the user model and at the same time pick a number of languages (via checkbox) the user knows from the form? Basically I want there to be a checkbox for every language and then the user checks which one he/she knows after which associations will be created between that user and the languages. Problem is I have no idea where to even start with this, since I'm a rails newbie. I tried some stuff like collection_boxes and form nesting but to no avail. Can somebody at least point me in the direction of what I should be looking for? Here is the current view which edits the user model, I'd like to add the checkboxes here. Gmaz fucked around with this message at 13:14 on May 8, 2014 |
# ? May 8, 2014 13:00 |
|
Any resources on figuring out what app/web server to use? I've been using Unicorn on Heroku and it works fine. I'm looking into experimenting with AWS micro instances and my current plan is to use Nginx and Unicorn. Unfortunately, I haven't been able to find decent benchmarks for when to use which app server. For instance, there are a number of tiny traffic apps that I was thinking of deploying on a single micro instance. Would something like Phusion Passenger make more sense in a situation like this? I ask because I'm reading that Phusio can handle multiple apps out of the box, whereas with Unicorn I'd need to start a new Unicorn master process for each app, as far as I understand.
|
# ? May 9, 2014 10:25 |
|
|
# ? May 15, 2024 03:01 |
|
Sil posted:Wait. Where did I pick up that """ """ thing? It must have been some rails tutorial book, but I could have sworn they said that's the way to do multiline strings in ruby. I see now, in IRB, that regular string literals do that just fine. Not sure. It's common in Cucumber, maybe from there? I'm not a fan of it myself, but they're all fairly horrible options when you've got to keep strict whitespace formatting in your multiline string. Not sure whether """ does anything special.
|
# ? May 9, 2014 11:26 |