|
Based on what I've read, Amazon OpsWorks seems to be based on Chef so that's enough of a reason in and of itself, and also it seems more of a 'community' standard on the whole - at least that's the impression I've gotten. I actually quite like Puppet and already know it through using Boxen for my machines, but I think for deployment, Chef makes the most sense. Will check out that peepcode screencast - thanks.
|
# ? Jul 11, 2013 23:08 |
|
|
# ? May 15, 2024 02:49 |
|
So, here's what happens when you run a postgres service for a few years. You go to make a new active record class on some app, and run into an error. Oh a straight-forward protected attribute thing, oh yeah I remember that. Fix it, and run into something else, say gently caress it and do this:Ruby code:
Ruby code:
|
# ? Jul 12, 2013 06:51 |
|
kayakyakr posted:New is a view-only route. The create is triggered by POSTing the index route, ie athlete_training_plans_path. Thanks, that fixed that problem, I can now create a training object, or at least it says I am successfully creating a training object, but it doesn't seem to save the parameters of the training plan. It is getting them as parameters, but not including them in the SQL insert statement: code:
When I hit "back" it gives me a new error: No route matches {:action=>"edit", :controller=>"training_plans", :athlete_id=>#<TrainingPlan id: 15, planName: nil, planStartDate: nil, planEndDate: nil, athlete_id: 1, created_at: "2013-07-11 18:51:41", updated_at: "2013-07-11 18:51:41">, :id=>nil, :format=>nil} missing required keys: [:id] and here's the code from the index.html.erb file: code:
code:
|
# ? Jul 12, 2013 16:26 |
|
I have a namespace in my routes. Pages in that namespace are not having the application.js compiled for them. What are things I should be considering when when it comes to namespaced routes and the asset pipeline?
|
# ? Jul 12, 2013 16:53 |
|
KoRMaK posted:I have a namespace in my routes. Pages in that namespace are not having the application.js compiled for them. What are things I should be considering when when it comes to namespaced routes and the asset pipeline? Are they on a different layout? As long as they're in the same layout, they should be including application. Otherwise, make sure whatever layout they're in is including application.js. The asset pipeline doesn't really care much about routes. Newbsylberry posted:
Selected just the code that's causing you issues. edit_athlete_training_plan_path is expecting an athlete id and a training plan id. Apparently it's not smart enough to pull those off of the object, but you can. code:
|
# ? Jul 12, 2013 18:28 |
|
Wondering if you guys have any thoughts on migrating a table from being in MySQL to some sort of non-relational form? Our app has a table with several million rows, and is growing rapidly. One of the columns is a hash that we manipulate/store various elements in that don't otherwise belong as columns, but is serialized as JSON. I know that MongoDB stores JSON objects so this seems like a natural fit? I was thinking we'd merge the other columns with the hash column and store that thing in MongoDB. Does rails support it reasonably well as a persistence layer?
|
# ? Jul 12, 2013 22:31 |
|
Lexicon posted:Wondering if you guys have any thoughts on migrating a table from being in MySQL to some sort of non-relational form? Our app has a table with several million rows, and is growing rapidly. One of the columns is a hash that we manipulate/store various elements in that don't otherwise belong as columns, but is serialized as JSON. I enjoy Mongoid as an ORM. Does a good job and is pretty easy to move over to for those used to relational db's. I don't know how migrating to it would go. Are you sure you shouldn't just refactor your current relational database? A meta column is usually not a good idea and when your table is going to grow to to millions of rows, that means you've got other things going on.
|
# ? Jul 12, 2013 22:49 |
|
kayakyakr posted:I enjoy Mongoid as an ORM. Does a good job and is pretty easy to move over to for those used to relational db's. We're pretty happy with the concept of most of this staying in MySQL and shoving this one table into a system like MongoDB. I hear your point about the meta column - we reckon it's the best solution as otherwise it would mean adding 20-50+ tables to store each of these structures.
|
# ? Jul 12, 2013 23:11 |
|
Lexicon posted:Wondering if you guys have any thoughts on migrating a table from being in MySQL to some sort of non-relational form? Our app has a table with several million rows, and is growing rapidly. One of the columns is a hash that we manipulate/store various elements in that don't otherwise belong as columns, but is serialized as JSON. Use postgres and the built-in hstore key/value datatype. http://schneems.com/post/19298469372/you-got-nosql-in-my-postgres-using-hstore-in-rails
|
# ? Jul 12, 2013 23:45 |
|
I have a form for cellaring beers right now which looks like this:code:
code:
CellaredBeer.add_to_cellar(1, 1, 2009, "12oz", 6) And I get the expected result of adding an entry for user 1, of cellaring beer 1 with year 2009, 12oz size, and 6 of them. However, in my view, when I load the page, I get a "nil can't be coerced into Fixnum" error. Looking at the local variables, I see that indeed, year, size, and quantity are all nil. What do I need to do to get the form to not try to add_to_cellar until the user clicks submit?
|
# ? Jul 15, 2013 17:29 |
|
Can you invite some of us to this app once you're done? All I've been reading about for 3 odd months on this thread is cellaring beers this, and cellaring beers that
|
# ? Jul 15, 2013 18:08 |
|
Lexicon posted:Can you invite some of us to this app once you're done? All I've been reading about for 3 odd months on this thread is cellaring beers this, and cellaring beers that Absolutely! Once this cellar part is down, the basic site can go up. I just wanted a way to keep track of all the beer my wife and I keep in the cellar, and let other people do the same, and be able to setup trades/bottle shares. For reference, here is a pic of the cellar:
|
# ? Jul 15, 2013 18:16 |
|
Jesus, that's an epic beer cellar. Nicely done!
|
# ? Jul 15, 2013 18:23 |
|
I really want to know what that sign says.
|
# ? Jul 15, 2013 18:29 |
Nybble posted:I really want to know what that sign says. Probably something about crying over spilled milk that should have been beer? Or something IDK
|
|
# ? Jul 15, 2013 18:30 |
|
A MIRACLE posted:Probably something about crying over spilled milk that should have been beer? Or something IDK Ding ding ding!
|
# ? Jul 15, 2013 18:39 |
|
Lexicon posted:Wondering if you guys have any thoughts on migrating a table from being in MySQL to some sort of non-relational form? Our app has a table with several million rows, and is growing rapidly. One of the columns is a hash that we manipulate/store various elements in that don't otherwise belong as columns, but is serialized as JSON. Pardot posted:Use postgres and the built-in hstore key/value datatype. http://schneems.com/post/19298469372/you-got-nosql-in-my-postgres-using-hstore-in-rails And if it's not just a flat JSON hash, Postgres 9.2 also has a JSON column type that lets you query against it. Don't go NoSQL unless you absolutely have to, and if you're going NoSQL you can do better than Mongo.
|
# ? Jul 15, 2013 18:51 |
|
Cocoa Crispies posted:And if it's not just a flat JSON hash, Postgres 9.2 also has a JSON column type that lets you query against it. Great to know. Thanks... this will likely come in handy.
|
# ? Jul 15, 2013 19:10 |
|
raej posted:I have a form for cellaring beers right now which looks like this: Your params bit is wrong. :year, :size, and :date are attributes on @cellared_beer, so you'd want something like this: code:
(or appropriate debugging gems but hell I'm still in printf mode)
|
# ? Jul 16, 2013 00:12 |
|
I'm trying to get a general idea of how peoples' workflows in Rails development look. Say if you're working on an application for a client, how do you handle the copy that you're working on versus test on the server versus production on the server? Do people typically use an IDE with git integration as their main platform, and then when it comes time to affect changes copy the files to the dev environment on the server, run the migrations, and then test, and if it's all good repeat the process for live? Apologies if this has been asked somewhere in the previous 110 pages.
|
# ? Jul 16, 2013 08:13 |
|
theodop posted:I'm trying to get a general idea of how peoples' workflows in Rails development look. I'm cocky, so if I "know*" a change doesn't need manual testing, I'll push straight to production. If I'm less confident that my specs don't cover everything I push to myapp-staging and try it out there, or I'll ask other team members to do a code review. If I'm super uncertain I'll do both. A copy change, I'll just push straight to prod, who cares? * I have caused short outages because due to overconfidence, but they're weren't that bad… rollback is easy. Pardot fucked around with this message at 08:39 on Jul 16, 2013 |
# ? Jul 16, 2013 08:35 |
|
theodop posted:Say if you're working on an application for a client, how do you handle the copy that you're working on versus test on the server versus production on the server? Development machine with identical staging and production machines. Dev and staging servers are virtual machines. Development happens on dev machine. Seperate development and master trees. Development branches get merged to development tree when tests pass and then pushed to staging server with capistrano for testing/preview/etc. Once the code is ready, it gets merged into the master tree and put into production. Staging server also lets the marketing person create content without making it available to the public. It's a little complicated for a solo developer and two marketing people but it has its benefits. For small, well known changes, I just skip staging and go straight to production but code still passes through the correct trees.
|
# ? Jul 16, 2013 13:51 |
|
Obsurveyor posted:Development machine with identical staging and production machines. Dev and staging servers are virtual machines. Development happens on dev machine. Seperate development and master trees. Development branches get merged to development tree when tests pass and then pushed to staging server with capistrano for testing/preview/etc. Once the code is ready, it gets merged into the master tree and put into production. Staging server also lets the marketing person create content without making it available to the public. This is probably the safest, most "correct" process. For most of the stuff I do, I've gotten into the habit of testing locally and pushing straight to the production server. *shrug* It is what it is. theodop posted:Do people typically use an IDE with git integration as their main platform, and then when it comes time to affect changes copy the files to the dev environment on the server, run the migrations, and then test, and if it's all good repeat the process for live? I think most people use command line git and then either capistrano or an environment like heroku where a remote repository lives on the production server and promoting to production is just a matter of pushing to it. If you're working with rails, get comfortable with terminals and your productivity will go way up.
|
# ? Jul 16, 2013 14:36 |
|
The Journey Fraternity posted:Your params bit is wrong. :year, :size, and :date are attributes on @cellared_beer, so you'd want something like this: I tried the [:cellared_beer][:year] etc changes, but have been running into another error: undefined method `[]' for nil:NilClass In the console in chrome, I see this: >> @cellared_beer => nil >> current_user.id => 1 >> @beer.id => 1 >> params[:cellared_beer][:year] !! #<NoMethodError: undefined method `[]' for nil:NilClass> >> Is there some way to tell it not to try and analyze the form until submit is clicked?
|
# ? Jul 16, 2013 20:11 |
Paste your params hash?
|
|
# ? Jul 16, 2013 20:29 |
|
A MIRACLE posted:Paste your params hash? code:
|
# ? Jul 16, 2013 20:52 |
|
The thing you are looking for does not exist in the params hash.
|
# ? Jul 16, 2013 20:55 |
Request parameters {"action"=>"show", "controller"=>"beers", "id"=>"1"} I'm not sure how your routes are set up or what kind of request your making. Is this a GET or a POST? Is it through a form or are you trying to link to it somewhere? Either way the params hash knows nothing about a :cellared_beer, so you have to supply that somehow.
|
|
# ? Jul 16, 2013 21:14 |
|
Am I setting this whole form up wrong then? It's a view for Beer which displays all the info on a beer. The form is for Cellared_Beer which is a physical instance of a beer a user has. The idea is to have a form on the Beer page for a user to add to their cellar (Cellared_Beer) based on adding Year, Size, and Quantity and taking the beer (which is the page you're on) and the user (current_user)
|
# ? Jul 16, 2013 21:14 |
|
raej posted:Am I setting this whole form up wrong then? Here's an example of what my params look like on a form submit: Ruby code:
|
# ? Jul 16, 2013 21:23 |
|
Is there a commonly accepted pattern for moving data between multiple tables when doing a migration? For example, say I want to denormalize a table. Do I do that all within one single migration? Create table, run a bunch of logic to copy data to target table, update source table to complete? Also, would I even want to bother with rollback logic in this case? Seems like mostly a 1 way street, you wouldn't get much value out of writing a way of reversing that.
|
# ? Jul 17, 2013 01:48 |
|
Depends on what you need. The simple case is just "Update foo, bar set foo.baz = bar.baz where whatever" and so on. Edit: like this migration, where we moved few columns to from one table to another (they have a 1:1 relationship). Ruby code:
Smol fucked around with this message at 07:28 on Jul 17, 2013 |
# ? Jul 17, 2013 03:51 |
|
We usually put ours in a migration so that when it gets to production we just run it. It's been tested in 2 or 3 environments before it gets to there and it has worked reliably. e: I guess when I use it, it's a little different than what you are intending. But I'd give it a try.
|
# ? Jul 17, 2013 04:04 |
|
Smol posted:Depends on what you need. The simple case is just "Update foo, bar set foo.baz = bar.baz where whatever" and so on. This works but will cause an outage since Rails will continue to look for baz and qux until the application server restarts. Migrating data like this is usually a multi-step process of add column, modify app to write to both columns, copy old data and then drop the old column. It's normally not worth it for simple renames.
|
# ? Jul 17, 2013 16:42 |
|
Instead of writing that as SQL I would have written it as a ruby loop. e: inside of the migration. Like this Ruby code:
KoRMaK fucked around with this message at 17:04 on Jul 17, 2013 |
# ? Jul 17, 2013 16:44 |
|
My general rule for migrations is that unless I'm really interested in maintaining uptime and modifying the app to deal with both scenarios like dexter mentioned, you should always use one migration. Migrations are transactional so by using one you're not going to leave your DB in a weird state where half of the migration is applied if something fails.
|
# ? Jul 17, 2013 16:54 |
|
dexter posted:This works but will cause an outage since Rails will continue to look for baz and qux until the application server restarts. Migrating data like this is usually a multi-step process of add column, modify app to write to both columns, copy old data and then drop the old column. It's normally not worth it for simple renames. Planned downtime is not a problem for this app.
|
# ? Jul 17, 2013 17:09 |
|
enki42 posted:Migrations are transactional As long as you're using postgres, oracle, sql server (for some cases), sybase, db2, informix, or firebird/interbase. But not if you're using mysql.
|
# ? Jul 17, 2013 18:27 |
|
I thought you were going to be really pedantic and say that sqlite doesn't have transactions. MySql doesn't? Everytime I learn something new about that database, I wonder why anyone ever uses it in the first place.
|
# ? Jul 17, 2013 21:00 |
|
|
# ? May 15, 2024 02:49 |
|
enki42 posted:I thought you were going to be really pedantic and say that sqlite doesn't have transactions. MySql doesn't? Mysql has transactions in general, but you can't do alter table inside of a transaction and roll that back when something breaks partway through, so you get a nice mess of a half done migration.
|
# ? Jul 17, 2013 21:09 |