Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
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.

Adbot
ADBOT LOVES YOU

Pardot
Jul 25, 2001




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:
class AddEvents < ActiveRecord::Migration
  def up
    execute "create table events(id serial, name text not null, created_at timestamptz default now(), attrs hstore);"
    execute "create index on events (name);"
  end

Ruby code:
class Event
  def self.create(name, attrs={})
    attrs_hstore = attrs.select{|k,v| v}.map{|(k,v)| %Q("#{k.to_s}"=>"#{v.to_s}")}.join(',') 

    ActiveRecord::Base.connection.raw_connection.exec(
      'insert into events (name, attrs) values ($1, $2)',
      [name, attrs_hstore]
    )
  end
end
gently caress that noise

Newbsylberry
Dec 29, 2007

I Swim in drag shorts because I have a SMALL PENIS

kayakyakr posted:

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.

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:
Parameters: {"utf8"=>"&#10003;", "authenticity_token"=>"E0qb8OMJytqNdgZAZbZNSN2cIoJKkkar7JZ33a3B80Q=", 
"training_plan"=>{"planName"=>"Hello", "planStartDate(1i)"=>"2011", "planStartDate(2i)"=>"7", "planStartDate(3i)"=>"12", 
"planEndDate(1i)"=>"2013", "planEndDate(2i)"=>"7", "planEndDate(3i)"=>"12"}, "commit"=>"Create Training plan", "athlete_id"=>"1"}
  Athlete Load (0.4ms)  SELECT "athletes".* FROM "athletes" WHERE "athletes"."id" = $1 LIMIT 1  [["id", "1"]]
   (0.3ms)  BEGIN
  SQL (2.0ms)  INSERT INTO "training_plans" ("athlete_id", "created_at", "updated_at") VALUES ($1, $2, $3) 
RETURNING "id"  [["athlete_id", 1], ["created_at", Fri, 12 Jul 2013 15:13:43 UTC +00:00], 
["updated_at", Fri, 12 Jul 2013 15:13:43 UTC +00:00]]


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:
    <% @training_plans.each do |training_plan| %>
      <tr>
        <td><%= training_plan.planName %></td>
        <td><%= training_plan.planStartDate %></td>
        <td><%= training_plan.planEndDate %></td>
        <td><%= link_to 'Show', athlete_training_plans_path %></td>
        <td><%= link_to 'Edit', edit_athlete_training_plan_path(training_plan) %></td>
        <td><%= link_to 'Destroy', athlete_training_plan_path, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
I updated my controller too, so here's what I updated:

code:
  def create
    @athlete = Athlete.find(params[:athlete_id])
    @training_plans = @athlete.training_plans.new(params[training_plan_params])

    respond_to do |format|
      if @training_plans.save
        format.html { redirect_to [ @athlete, @training_plans ], notice: 'Training plan was successfully created.' }
        format.json { render action: 'show', status: :created, location: [ @athlete, @training_plans ] }
      else
        format.html { render action: 'new' }
        format.json { render json: @training_plans.errors, status: :unprocessable_entity }
      end
    end
  end
I'm sorry for not being able to describe the problem better, I am working on going through different tutorials currently, but I have had a hard time sticking with it in the past. I am hoping that actually working with my own app will help me learn the ins and outs, however thus far I have hit a lot of road blocks. I appreciate any help that can be given.

KoRMaK
Jul 31, 2012



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?

kayakyakr
Feb 16, 2004

Kayak is true

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:


code:
Parameters: {"utf8"=>"&#10003;", "authenticity_token"=>"E0qb8OMJytqNdgZAZbZNSN2cIoJKkkar7JZ33a3B80Q=", 
"training_plan"=>{"planName"=>"Hello", "planStartDate(1i)"=>"2011", "planStartDate(2i)"=>"7", "planStartDate(3i)"=>"12", 
"planEndDate(1i)"=>"2013", "planEndDate(2i)"=>"7", "planEndDate(3i)"=>"12"}, "commit"=>"Create Training plan", "athlete_id"=>"1"}


code:
        <td><%= link_to 'Edit', edit_athlete_training_plan_path(training_plan) %></td>
        <td><%= link_to 'Destroy', athlete_training_plan_path, method: :delete, data: { confirm: 'Are you sure?' } %></td>
I updated my controller too, so here's what I updated:

code:
    @training_plans = @athlete.training_plans.new(params[training_plan_params])

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:
edit_athlete_training_plan_path(training_plan.athlete_id, training_plan.id)
athlete_training_plan_path(training_plan.athlete_id, training_plan.id)
And your problem with saving is that params[training_plan_params] is not what contains the training plan properties. Take a look at what your server is telling you the params object looks like (also left in the quoted text above). That should also be a symbol or string, otherwise you're basically looking up params[undefined] or params[nil] which would also be nothing.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
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?

kayakyakr
Feb 16, 2004

Kayak is true

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 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?

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.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

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.

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.

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.

Pardot
Jul 25, 2001




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 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?

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

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."
I have a form for cellaring beers right now which looks like this:
code:
%= form_for(@cellared_beer) do |f| %>

      <%= f.label @beer.name %>
      <%= f.hidden_field :beer_id, value: @beer.id, :readonly => true %>

      <%= f.label :year %>
      <%= select_year(Date.today, :start_year => Time.now.year, :end_year => Time.now.year - 50, :field_name => :year, :prefix => :cellared_beer) %>

      <%= f.label :size %> 
      <%= f.select :size, options_for_select([["12oz","12oz"],["22oz","22oz"],["750mL","750mL"],["Other","Other"]]) %>

      <%= f.label :qty %>
      <%= f.text_field :qty, :required => true, :value => "1" %>

      <%= f.submit "Cellar", class: "btn btn-warning" %>
    <% end %>
My controller looks like this:
code:
@cellared_beer = CellaredBeer.add_to_cellar(current_user.id, @beer.id, params[:year], params[:size], params[:date])
When I'm in console, I can run the command
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?

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
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 :)

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."

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:

Only registered members can see post attachments!

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
Jesus, that's an epic beer cellar. Nicely done!

Nybble
Jun 28, 2008

praise chuck, raise heck
I really want to know what that sign says.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

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

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."

A MIRACLE posted:

Probably something about crying over spilled milk that should have been beer? Or something IDK

Ding ding ding!

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

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 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?


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.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

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.

Don't go NoSQL unless you absolutely have to, and if you're going NoSQL you can do better than Mongo.

Great to know. Thanks... this will likely come in handy.

The Journey Fraternity
Nov 25, 2003



I found this on the ground!

raej posted:

I have a form for cellaring beers right now which looks like this:
code:
%= form_for(@cellared_beer) do |f| %>

      <%= f.label @beer.name %>
      <%= f.hidden_field :beer_id, value: @beer.id, :readonly => true %>

      <%= f.label :year %>
      <%= select_year(Date.today, :start_year => Time.now.year, :end_year => Time.now.year - 50, :field_name => :year, :prefix => :cellared_beer) %>

      <%= f.label :size %> 
      <%= f.select :size, options_for_select([["12oz","12oz"],["22oz","22oz"],["750mL","750mL"],["Other","Other"]]) %>

      <%= f.label :qty %>
      <%= f.text_field :qty, :required => true, :value => "1" %>

      <%= f.submit "Cellar", class: "btn btn-warning" %>
    <% end %>
My controller looks like this:
code:
@cellared_beer = CellaredBeer.add_to_cellar(current_user.id, @beer.id, params[:year], params[:size], params[:date])
When I'm in console, I can run the command
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?

Your params bit is wrong. :year, :size, and :date are attributes on @cellared_beer, so you'd want something like this:

code:
@cellared_beer = CellaredBeer.add_to_cellar(current_user.id, @beer.id, params[:cellared_beer][:year], params[:cellared_beer][:size], params[:cellared_beer][:date])
As an aside, `render text: params.inspect` is a lifesaver in these sorts of situations.

(or appropriate debugging gems but hell I'm still in printf mode)

theodop
Dec 30, 2005

rock solid, heart touching
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.

Pardot
Jul 25, 2001




theodop posted:

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.

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

Obsurveyor
Jan 10, 2003

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.

kayakyakr
Feb 16, 2004

Kayak is true

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.

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.

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.

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."

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:

code:
@cellared_beer = CellaredBeer.add_to_cellar(current_user.id, @beer.id, params[:cellared_beer][:year], params[:cellared_beer][:size], params[:cellared_beer][:date])
As an aside, `render text: params.inspect` is a lifesaver in these sorts of situations.

(or appropriate debugging gems but hell I'm still in printf mode)

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?

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Paste your params hash?

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."

A MIRACLE posted:

Paste your params hash?

code:
Request info

Request parameters	
{"action"=>"show", "controller"=>"beers", "id"=>"1"}
Rack session	
{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}
Local Variables

Instance Variables

@_routes	
nil
@_action_has_layout	
true
@_headers	
{"Content-Type"=>"text/html"}
@_status	
200
@_request	
#<ActionDispatch::Request:0x2857ec0 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/beers/1", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"activate.adobe.com", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/beers/1", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2012-02-16)", "HTTP_HOST"=>"localhost:3000", "HTTP_CONNECTION"=>"keep-alive", "HTTP_CACHE_CONTROL"=>"max-age=0", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "HTTP_COOKIE"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x286c950>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/beers/1", "ORIGINAL_FULLPATH"=>"/beers/1", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x3c7eff0>, "action_dispatch.parameter_filter"=>[:password, :password_confirmation], "action_dispatch.secret_token"=>"a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", "action_dispatch.show_exceptions"=>true, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<ActiveSupport::TaggedLogging:0x35d8940 @logger=#<ActiveSupport::BufferedLogger:0x35d8ee0 @log_dest=#<File:c:/Sites/alespace/log/development.log>, @log=#<Logger:0x35d8ec8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x35d8e08 @datetime_format=nil>, @formatter=#<Logger::SimpleFormatter:0x35d8958 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x35d8b50 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:c:/Sites/alespace/log/development.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x35d8ad8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x35d8970>>>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x35d2a90 @filters=[#<Proc:0x35bde20@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x35be000@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x35be300@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x2735e38@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:26>], @silencers=[#<Proc:0x2735ca0@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.request_id"=>"b08329922d77254b482aecb835265bc4", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"f6a0a0395306514696f3829700d371c2c7a8310c5d19f0b13b76dc96b883", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x3ba1ec0>, :id=>"55d38cad7cb37e45aeb926b195b8ff41"}, "rack.request.cookie_hash"=>{"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, "rack.request.cookie_string"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x285f1f8 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @set_cookies={}, @delete_cookies={}, @host="localhost", @secure=false, @closed=false, @cookies={"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, @signed=#<ActionDispatch::Cookies::SignedCookieJar:0x285fde0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x285f1f8 ...>, @verifier=#<ActiveSupport::MessageVerifier:0x285fe88 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @digest="SHA1", @serializer=Marshal>>>, "action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "warden"=>Warden::Proxy:21169056 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{:user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x4b89790>}, "action_dispatch.request.path_parameters"=>{:action=>"show", :controller=>"beers", :id=>"1"}, "action_controller.instance"=>#<BeersController:0x2857de8 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionDispatch::Request:0x2857ec0 ...>, @_response=#<ActionDispatch::Response:0x2857f20 @body=[], @header={}, @status=200, @sending_file=false, @blank=false, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x2857ec0 ...>>, @_env={...}, @_prefixes=["beers", "application"], @_lookup_context=#<ActionView::LookupContext:0x2858460 @details_key=nil, @details={:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}, @skip_default_locale=false, @cache=true, @prefixes=["beers", "application"], @rendered_format=nil, @view_paths=#<ActionView::PathSet:0x28584d8 @paths=[c:/Sites/alespace/app/views, C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.3/app/views]>>, @_action_name="show", @_response_body=nil, @_config={}, @_params={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @beer=#<Beer id: 1, name: "Poop beer", style: 0, brewery_id: 1, abv: #<BigDecimal:5171d60,'0.32E1',18(45)>, desc: "Made from poop!", ibu: 33, created_at: "2013-02-21 01:02:06", updated_at: "2013-02-21 01:02:06">, @_url_options={:host=>"localhost", :port=>3000, :protocol=>"http://", :_path_segments=>{:action=>"show", :controller=>"beers", :id=>"1"}}, @current_user=#<User id: 1, email: "prognar@gmail.com", encrypted_password: "$2a$10$e5BspE9SV9iFus3Kd1SDwOS8QajKn1J1.5HLIWNFtgap...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 22, current_sign_in_at: "2013-07-15 16:04:22", last_sign_in_at: "2013-05-22 19:15:33", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "192.168.1.10", created_at: "2013-02-20 23:36:03", updated_at: "2013-07-15 16:04:22", name: "Andrew Campbell", avatar_url: nil, username: nil>>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"action"=>"show", "controller"=>"beers", "id"=>"1"}, "action_dispatch.request.formats"=>[text/html]}, @request_method="GET", @filtered_parameters={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @method="GET", @fullpath="/beers/1", @port=3000, @protocol="http://", @symbolized_path_params={:action=>"show", :controller=>"beers", :id=>"1"}>
@_response	
#<ActionDispatch::Response:0x2857f20 @body=[], @header={}, @status=200, @sending_file=false, @blank=false, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x2857ec0 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/beers/1", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"activate.adobe.com", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/beers/1", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2012-02-16)", "HTTP_HOST"=>"localhost:3000", "HTTP_CONNECTION"=>"keep-alive", "HTTP_CACHE_CONTROL"=>"max-age=0", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "HTTP_COOKIE"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x286c950>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/beers/1", "ORIGINAL_FULLPATH"=>"/beers/1", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x3c7eff0>, "action_dispatch.parameter_filter"=>[:password, :password_confirmation], "action_dispatch.secret_token"=>"a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", "action_dispatch.show_exceptions"=>true, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<ActiveSupport::TaggedLogging:0x35d8940 @logger=#<ActiveSupport::BufferedLogger:0x35d8ee0 @log_dest=#<File:c:/Sites/alespace/log/development.log>, @log=#<Logger:0x35d8ec8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x35d8e08 @datetime_format=nil>, @formatter=#<Logger::SimpleFormatter:0x35d8958 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x35d8b50 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:c:/Sites/alespace/log/development.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x35d8ad8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x35d8970>>>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x35d2a90 @filters=[#<Proc:0x35bde20@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x35be000@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x35be300@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x2735e38@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:26>], @silencers=[#<Proc:0x2735ca0@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.request_id"=>"b08329922d77254b482aecb835265bc4", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"f6a0a0395306514696f3829700d371c2c7a8310c5d19f0b13b76dc96b883", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x3ba1ec0>, :id=>"55d38cad7cb37e45aeb926b195b8ff41"}, "rack.request.cookie_hash"=>{"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, "rack.request.cookie_string"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x285f1f8 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @set_cookies={}, @delete_cookies={}, @host="localhost", @secure=false, @closed=false, @cookies={"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, @signed=#<ActionDispatch::Cookies::SignedCookieJar:0x285fde0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x285f1f8 ...>, @verifier=#<ActiveSupport::MessageVerifier:0x285fe88 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @digest="SHA1", @serializer=Marshal>>>, "action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "warden"=>Warden::Proxy:21169056 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{:user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x4b89790>}, "action_dispatch.request.path_parameters"=>{:action=>"show", :controller=>"beers", :id=>"1"}, "action_controller.instance"=>#<BeersController:0x2857de8 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionDispatch::Request:0x2857ec0 ...>, @_response=#<ActionDispatch::Response:0x2857f20 ...>, @_env={...}, @_prefixes=["beers", "application"], @_lookup_context=#<ActionView::LookupContext:0x2858460 @details_key=nil, @details={:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}, @skip_default_locale=false, @cache=true, @prefixes=["beers", "application"], @rendered_format=nil, @view_paths=#<ActionView::PathSet:0x28584d8 @paths=[c:/Sites/alespace/app/views, C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.3/app/views]>>, @_action_name="show", @_response_body=nil, @_config={}, @_params={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @beer=#<Beer id: 1, name: "Poop beer", style: 0, brewery_id: 1, abv: #<BigDecimal:5039838,'0.32E1',18(45)>, desc: "Made from poop!", ibu: 33, created_at: "2013-02-21 01:02:06", updated_at: "2013-02-21 01:02:06">, @_url_options={:host=>"localhost", :port=>3000, :protocol=>"http://", :_path_segments=>{:action=>"show", :controller=>"beers", :id=>"1"}}, @current_user=#<User id: 1, email: "prognar@gmail.com", encrypted_password: "$2a$10$e5BspE9SV9iFus3Kd1SDwOS8QajKn1J1.5HLIWNFtgap...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 22, current_sign_in_at: "2013-07-15 16:04:22", last_sign_in_at: "2013-05-22 19:15:33", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "192.168.1.10", created_at: "2013-02-20 23:36:03", updated_at: "2013-07-15 16:04:22", name: "Andrew Campbell", avatar_url: nil, username: nil>>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"action"=>"show", "controller"=>"beers", "id"=>"1"}, "action_dispatch.request.formats"=>[text/html]}, @request_method="GET", @filtered_parameters={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @method="GET", @fullpath="/beers/1", @port=3000, @protocol="http://", @symbolized_path_params={:action=>"show", :controller=>"beers", :id=>"1"}>>
@_env	
{"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/beers/1", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"activate.adobe.com", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/beers/1", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2012-02-16)", "HTTP_HOST"=>"localhost:3000", "HTTP_CONNECTION"=>"keep-alive", "HTTP_CACHE_CONTROL"=>"max-age=0", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "HTTP_COOKIE"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x286c950>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/beers/1", "ORIGINAL_FULLPATH"=>"/beers/1", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x3c7eff0>, "action_dispatch.parameter_filter"=>[:password, :password_confirmation], "action_dispatch.secret_token"=>"a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", "action_dispatch.show_exceptions"=>true, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<ActiveSupport::TaggedLogging:0x35d8940 @logger=#<ActiveSupport::BufferedLogger:0x35d8ee0 @log_dest=#<File:c:/Sites/alespace/log/development.log>, @log=#<Logger:0x35d8ec8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x35d8e08 @datetime_format=nil>, @formatter=#<Logger::SimpleFormatter:0x35d8958 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x35d8b50 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:c:/Sites/alespace/log/development.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x35d8ad8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x35d8970>>>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x35d2a90 @filters=[#<Proc:0x35bde20@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x35be000@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x35be300@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x2735e38@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:26>], @silencers=[#<Proc:0x2735ca0@C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.request_id"=>"b08329922d77254b482aecb835265bc4", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"f6a0a0395306514696f3829700d371c2c7a8310c5d19f0b13b76dc96b883", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x3ba1ec0>, :id=>"55d38cad7cb37e45aeb926b195b8ff41"}, "rack.request.cookie_hash"=>{"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, "rack.request.cookie_string"=>"_rails3-bootstrap-devise-cancan_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26", "action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x285f1f8 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @set_cookies={}, @delete_cookies={}, @host="localhost", @secure=false, @closed=false, @cookies={"_rails3-bootstrap-devise-cancan_session"=>"BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTU1ZDM4Y2FkN2NiMzdlNDVhZWI5MjZiMTk1YjhmZjQxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQ2amxOK0RaUysvWmJMK0owaytEcVNvNDRXWDVzQmNYcEN0UmJrM0FuL009BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJGU1QnNwRTlTVjlpRnVzM0tkMVNEd08GOwBU--00e266ddcf9ba3617644ccff38bc731dfd00ba26"}, @signed=#<ActionDispatch::Cookies::SignedCookieJar:0x285fde0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x285f1f8 ...>, @verifier=#<ActiveSupport::MessageVerifier:0x285fe88 @secret="a6cd68af2c0c93e2f0bd4c576aab509f59b7ae839d02018caa4c8ce3cc46ea012fdc4f1dc93bbb14137bc646fb697907e9649260d02b77eed838717d20dff479", @digest="SHA1", @serializer=Marshal>>>, "action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"55d38cad7cb37e45aeb926b195b8ff41", "_csrf_token"=>"D6jlN+DZS+/ZbL+J0k+DqSo44WX5sBcXpCtRbk3An/M=", "warden.user.user.key"=>["User", [1], "$2a$10$e5BspE9SV9iFus3Kd1SDwO"]}, "warden"=>Warden::Proxy:21169056 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{:user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x4b89790>}, "action_dispatch.request.path_parameters"=>{:action=>"show", :controller=>"beers", :id=>"1"}, "action_controller.instance"=>#<BeersController:0x2857de8 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionDispatch::Request:0x2857ec0 @env={...}, @request_method="GET", @filtered_parameters={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @method="GET", @fullpath="/beers/1", @port=3000, @protocol="http://", @symbolized_path_params={:action=>"show", :controller=>"beers", :id=>"1"}>, @_response=#<ActionDispatch::Response:0x2857f20 @body=[], @header={}, @status=200, @sending_file=false, @blank=false, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x2857ec0 @env={...}, @request_method="GET", @filtered_parameters={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @method="GET", @fullpath="/beers/1", @port=3000, @protocol="http://", @symbolized_path_params={:action=>"show", :controller=>"beers", :id=>"1"}>>, @_env={...}, @_prefixes=["beers", "application"], @_lookup_context=#<ActionView::LookupContext:0x2858460 @details_key=nil, @details={:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}, @skip_default_locale=false, @cache=true, @prefixes=["beers", "application"], @rendered_format=nil, @view_paths=#<ActionView::PathSet:0x28584d8 @paths=[c:/Sites/alespace/app/views, C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.3/app/views]>>, @_action_name="show", @_response_body=nil, @_config={}, @_params={"action"=>"show", "controller"=>"beers", "id"=>"1"}, @beer=#<Beer id: 1, name: "Poop beer", style: 0, brewery_id: 1, abv: #<BigDecimal:50567b8,'0.32E1',18(45)>, desc: "Made from poop!", ibu: 33, created_at: "2013-02-21 01:02:06", updated_at: "2013-02-21 01:02:06">, @_url_options={:host=>"localhost", :port=>3000, :protocol=>"http://", :_path_segments=>{:action=>"show", :controller=>"beers", :id=>"1"}}, @current_user=#<User id: 1, email: "prognar@gmail.com", encrypted_password: "$2a$10$e5BspE9SV9iFus3Kd1SDwOS8QajKn1J1.5HLIWNFtgap...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 22, current_sign_in_at: "2013-07-15 16:04:22", last_sign_in_at: "2013-05-22 19:15:33", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "192.168.1.10", created_at: "2013-02-20 23:36:03", updated_at: "2013-07-15 16:04:22", name: "Andrew Campbell", avatar_url: nil, username: nil>>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"action"=>"show", "controller"=>"beers", "id"=>"1"}, "action_dispatch.request.formats"=>[text/html]}
@_prefixes	
["beers", "application"]
@_lookup_context	
#<ActionView::LookupContext:0x2858460 @details_key=nil, @details={:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}, @skip_default_locale=false, @cache=true, @prefixes=["beers", "application"], @rendered_format=nil, @view_paths=#<ActionView::PathSet:0x28584d8 @paths=[c:/Sites/alespace/app/views, C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.3/app/views]>>
@_action_name	
"show"
@_response_body	
nil
@_config	
{}
@_params	
{"action"=>"show", "controller"=>"beers", "id"=>"1"}
@beer	
#<Beer id: 1, name: "Poop beer", style: 0, brewery_id: 1, abv: #<BigDecimal:506d978,'0.32E1',18(45)>, desc: "Made from poop!", ibu: 33, created_at: "2013-02-21 01:02:06", updated_at: "2013-02-21 01:02:06">
@_url_options	
{:host=>"localhost", :port=>3000, :protocol=>"http://", :_path_segments=>{:action=>"show", :controller=>"beers", :id=>"1"}}
@current_user	
#<User id: 1, email: "prognar@gmail.com", encrypted_password: "$2a$10$e5BspE9SV9iFus3Kd1SDwOS8QajKn1J1.5HLIWNFtgap...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 22, current_sign_in_at: "2013-07-15 16:04:22", last_sign_in_at: "2013-05-22 19:15:33", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "192.168.1.10", created_at: "2013-02-20 23:36:03", updated_at: "2013-07-15 16:04:22", name: "Andrew Campbell", avatar_url: nil, username: nil>

KoRMaK
Jul 31, 2012



The thing you are looking for does not exist in the params hash.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

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.

raej
Sep 25, 2003

"Being drunk is the worst feeling of all. Except for all those other feelings."
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)

KoRMaK
Jul 31, 2012



raej posted:

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)
You must be because the params you pasted don't contain what you think they should. Also, that is alot of stuff to paste.

Here's an example of what my params look like on a form submit:
Ruby code:

Started PUT "/contacts/4" for 127.0.1.1 at 2013-07-16 16:21:32 -0400
Processing by ContactsController#update as HTML
  Parameters: {"utf8"=>"&#10003;", "authenticity_token"=>"7CK5Ns6XZ6EdvteONVJ1BPmdcP/PSbBx/GXL9YsvYmw=", 
"contact"=>{"first_name"=>"aaa", 
"last_name"=>"aaaa", 
"job_title"=>"eee", 
"department"=>"", 
"location_id"=>"", 
"work_email"=>"", 
"work_phone"=>"", 
"home_phone"=>"", 
"mobile_phone"=>"", 
"street_address"=>"", 
"city"=>"", 
"state"=>"AL", 
"postal_code"=>"", 
"country"=>"US",
 "tags"=>""}, "commit"=>"Save Changes", "id"=>"4"}

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
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.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.
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:
class MoveBazAndQuxFromBarToFoo < ActiveRecord::Migration
  def self.up
    add_column :foo, :baz, :string
    add_column :foo, :qux, :integer

    execute <<-SQL
      UPDATE foo, bar
      SET
        foo.baz = bar.baz,
        foo.qux = bar.qux
      WHERE bar.foo_id = foo.id
    SQL

    remove_column :bar, :baz
    remove_column :bar, :qux
  end

  def self.down
    add_column :bar, :baz, :string
    add_column :bar, :qux, :integer

    execute <<-SQL
      UPDATE foo, bar
      SET
        bar.:baz = foo.:baz,
        bar.qux = foo.qux
      WHERE bar.foo_id = foo.id
    SQL

    remove_column :foo, :baz
    remove_column :foo, :qux
  end
end

Smol fucked around with this message at 07:28 on Jul 17, 2013

KoRMaK
Jul 31, 2012



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.

dexter
Jun 24, 2003

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.

Edit: like this migration, where we moved few columns to from one table to another (they have a 1:1 relationship).

Ruby code:
class MoveBazAndQuxFromBarToFoo < ActiveRecord::Migration
  def self.up
    add_column :foo, :baz, :string
    add_column :foo, :qux, :integer

    execute <<-SQL
      UPDATE foo, bar
      SET
        foo.baz = bar.baz,
        foo.qux = bar.qux
      WHERE bar.foo_id = foo.id
    SQL

    remove_column :bar, :baz
    remove_column :bar, :qux
  end

  def self.down
    add_column :bar, :baz, :string
    add_column :bar, :qux, :integer

    execute <<-SQL
      UPDATE foo, bar
      SET
        bar.:baz = foo.:baz,
        bar.qux = foo.qux
      WHERE bar.foo_id = foo.id
    SQL

    remove_column :foo, :baz
    remove_column :foo, :qux
  end
end


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.

KoRMaK
Jul 31, 2012



Instead of writing that as SQL I would have written it as a ruby loop.

e: inside of the migration. Like this

Ruby code:
class AddClassToItems < ActiveRecord::Migration
  def change
    add_column :items, :class, :integer
    
    #also create settings for these fields
    g = Guide.create(:section => "items", :field_name => "class")      
    s = Setting.create( :account_id => -1, :field_guide => g, :order => 10)

  end
end

KoRMaK fucked around with this message at 17:04 on Jul 17, 2013

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
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.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.

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.

Pardot
Jul 25, 2001




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.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
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.

Adbot
ADBOT LOVES YOU

Pardot
Jul 25, 2001




enki42 posted:

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.

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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply