Activity Graph

Page 1 of 1


[19:44:59] _tpavel: has joined #RubyOnRails
[19:44:59] _tpavel: has joined #ruby
[20:22:50] _tpavel: Quit: Leaving


[09:44:59] _tpavel: has joined #ruby
[09:45:00] _tpavel: has joined #RubyOnRails
[09:47:03] _tpavel: Client Quit


[16:58:22] _tpavel: has joined #RubyOnRails
[16:58:22] _tpavel: has joined #ruby
[16:58:45] _tpavel: Read error: Connection reset by peer


[06:50:50] _tpavel: has joined #RubyOnRails
[06:50:50] _tpavel: has joined #ruby
[06:50:54] _tpavel: Read error: Connection reset by peer


[15:41:16] _tpavel: has joined #RubyOnRails
[15:41:16] _tpavel: has joined #ruby
[15:41:56] _tpavel: Read error: Connection reset by peer


[20:58:44] _tpavel: has joined #RubyOnRails
[20:58:44] _tpavel: has joined #ruby
[21:01:14] _tpavel: Client Quit


[17:21:58] _tpavel: has joined #RubyOnRails
[17:21:58] _tpavel: has joined #ruby
[17:51:49] _tpavel: Ping timeout: 250 seconds


[06:20:29] _tpavel: has joined #RubyOnRails
[06:20:29] _tpavel: has joined #ruby
[15:23:12] _tpavel: Quit: Leaving
[18:36:09] _tpavel: has joined #RubyOnRails
[18:36:09] _tpavel: has joined #ruby
[19:43:14] _tpavel: Quit: Leaving


[18:36:38] _tpavel: has joined #RubyOnRails
[18:36:38] _tpavel: has joined #ruby
[18:37:00] _tpavel: Read error: Connection reset by peer


[14:42:34] _tpavel: has joined #RubyOnRails
[14:42:34] _tpavel: has joined #ruby
[15:08:06] _tpavel: Hi, I'm trying to change my deployment with Capistrano to use foreman and exporting to upstart and I can't seem to make it work. I suspect rbenv is the problem. This is what I have: https://gist.github.com/tudorpavel/93d1dbd3b90ca1849e4a
[15:08:35] _tpavel: Does anyone have an idea what could be the problem?
[16:10:11] _tpavel: Quit: Leaving


[07:49:49] _tpavel: has joined #RubyOnRails
[07:49:49] _tpavel: has joined #ruby
[07:57:43] _tpavel: Quit: Leaving
[14:13:47] _tpavel: has joined #RubyOnRails
[14:13:47] _tpavel: has joined #ruby
[14:41:09] _tpavel: Quit: Leaving


[13:08:31] _tpavel: has joined #RubyOnRails
[13:08:31] _tpavel: has joined #ruby
[14:03:40] _tpavel: Quit: Leaving


[06:18:41] _tpavel: dopie, or use the task https://github.com/rvm/rvm1-capistrano3#install-ruby since you're using the gem
[06:20:11] _tpavel: did you install it with your deployment user?


[14:59:51] _tpavel: I need some help using RSpec's stub_const method. I've explained my problem in the gist: https://gist.github.com/tudorpavel/370085fbef4e72532b99
[16:01:40] _tpavel: Can anyone help me with this RSpec problem I'm having? https://gist.github.com/tudorpavel/370085fbef4e72532b99


[13:10:53] _tpavel: Hi all, I'm using Rails 4.1 and RSpec 3.1 and I'm failing to stub Rails secrets like so: https://gist.github.com/tudorpavel/cb76bfeb39b10a0daf5f
[13:11:46] _tpavel: Anyone have any idea how I can stub Rails 4.1 secrets? Basically, I'm getting an undefined method `allow' for #<Class:0x00000006baf468> error
[13:13:41] _tpavel: Fire-Dragon-DoL, damn, of course. Thanks! I was doing it inside a 'context' block instead of a 'describe' or 'it' block


[08:25:46] _tpavel: Hi all, I have an issue. I've implemented an advanced route constraint (http://guides.rubyonrails.org/routing.html#advanced-constraints) to restrict access to a subset of my routes on a staging server. The thing is, request are treated as local and a routing error is shown. I would like to show the 404 page only in that case. Is there an 'else' type of fallback for route constraints?


[17:14:12] _tpavel: JokesOnYou77, you can test both of them in rails console and check the output for what queries each of them run
[17:15:21] _tpavel: although, I'm not sure why you would want the redundant #all anyway
[17:30:06] _tpavel: loc22, you're using HABTM (has_and_belongs_to_many), right? Read this: http://guides.rubyonrails.org/association_basics.html#choosing-between-has-many-through-and-has-and-belongs-to-many
[17:30:53] _tpavel: momomomomo, yeah hehe. I wanted exactly that comparison. :P
[17:39:13] _tpavel: loc22, I'm with momomomomo's suggestion that it's docs reading time for you mister
[17:41:29] _tpavel: loc22, gl;hf


[11:08:07] _tpavel: hey, anyone have any idea why the last expectation fails here? https://gist.github.com/tudorpavel/719645ad9767f12dc6de
[11:09:05] _tpavel: I'm guessing it's because of the way let in RSpec works
[11:09:30] _tpavel: expected true got false
[11:09:46] _tpavel: RSpec 3.0, BTW
[11:11:35] _tpavel: crap, doh! Thanks tbuehlmann! :)
[11:23:54] _tpavel: tbuehlmann, I know, I did use that syntax before, but it didn't work for the same reason. I'm not sure about the << change(user.reload, :confirmed?) >> part. What about https://gist.github.com/tudorpavel/8baa6926f800820869f5 ?



[07:08:46] _tpavel: hey guys, anyone familiar with the Doorkeeper gem?
[07:13:42] _tpavel: ok, right. I'm creating an API that will be consumed by native mobile apps. I'm using OAuth2 for authentication with Doorkeeper and Devise for login/register.
[07:15:26] _tpavel: I want to expose the devise registration to an action in the API and that of course needs to be accessed without an access token. However, I still want to check the APP_ID and SECRET and restrict access based on those. I wasn't able to find out Doorkeeper does that check when requesting an access token
[07:17:03] _tpavel: it's a matter of checking the DB for matching APP_ID and SECRET, but I was wondering if there is a simple hook from Doorkeeper


[12:19:54] _tpavel: hey, quick question: how do you name fields that hold counted values such as number_of_shouts?
[12:21:43] _tpavel: rvanlieshout & sevenseacat: thanks, no other ideas? :D
[12:23:22] _tpavel: sevenseacat, it just feels like there should be a short way of expressing something like this. I think I'll go with shout_count.


[05:45:59] _tpavel: do the boogie


[08:06:35] _tpavel: hi, does anyone have any recommendations for building a Rails app that will also serve as a RESTful API for native mobile apps?
[08:12:50] _tpavel: pyemkey, something like http://railscasts.com/episodes/41-conditional-validations ?
[08:13:29] _tpavel: of course, this is pretty old and you should check the guides for syntax changes
[08:25:18] _tpavel: pyemkey, no prob. :)
[09:18:19] _tpavel: Hello, did anyone try to use Devise as an OAuth2 provider?


[07:28:09] _tpavel: how can I include a namespaced helper in a Mailer? For instance Admin::BlablaHelper
[07:29:49] _tpavel: sevenseacat, sure that always works, but I was wondering if there is a syntax to use the #helper method inside ActionMailer::Base
[07:32:10] _tpavel: and... does it have an easy answer? :)
[07:35:41] _tpavel: I found the syntax, the #helper method is actually defined in AbstractController::Helpers::ClassMethods and accepts the following syntax -> helper 'admin/blabla'
[09:58:23] _tpavel: strk, you should use the new expect syntax, and you can have customized messages like so: https://www.relishapp.com/rspec/rspec-expectations/docs/customized-message
[10:00:27] _tpavel: to_not be_nil
[10:02:40] _tpavel: what version of RSpec are you using?
[10:04:19] _tpavel: oh and sorry, it's actually expect(bla).not_to. I always get this one mixed up
[10:16:32] _tpavel: strk, oh ok. The new syntax was introduced only starting with version 2.14 .
[10:17:06] _tpavel: then check out the docs here for customized messages: https://www.relishapp.com/rspec/rspec-expectations/v/2-10/docs/customized-message
[10:17:35] _tpavel: it's basically what you suspected initially, but with a comma :)
[10:22:37] _tpavel: strk, but you can look into upgrading to 2.14, the old syntax should still be compatible and you can start getting used to the new syntax when writing new tests.
[10:26:07] _tpavel: strk, does it work without the 'data_import' part?
[10:27:13] _tpavel: it might not be scoped right. Make a gist of your code https://gist.github.com/
[10:32:43] _tpavel: so it's some other bug in your code?


[14:54:33] _tpavel: hydrozen, what do you mean by process?
[14:58:15] _tpavel: strk, http://www.ruby-doc.org/core-2.1.2/Hash.html#method-i-has_key-3F


[08:07:11] _tpavel: hi, I'm trying to debug a Savon SOAP request inside rails console and I want to see the XML request that gets constructed by calling client.call. Did anyone try to do this and has any tips?
[08:14:54] _tpavel: rvanlieshout, thanks. I've set { log_level: :debug, log: true, pretty_print_xml: true } options just to be sure and indeed the request XML is logged and pretty printed to $stdout


[10:56:07] _tpavel: what would you recommend I use to transliterate French characters to English characters (ex: ?gypte -> Egypte)?
[10:58:18] _tpavel: yes, but I have to manually define the rules inside locales, right?
[11:00:00] _tpavel: oh yes, it is! Great, thanks apeiros


[07:10:00] _tpavel: joy4u, you shouldn't commit your database.yml to git and put it manually in your `shared` folder and then just use ---> set :linked_files, %w{config/database.yml}
[07:11:27] _tpavel: joy4u, but if you insist on that, try with 'execute' instead of 'run'
[07:14:39] _tpavel: joy4u, can you gist your task with its context (the namespace it's in and the way it's called)?
[07:17:33] _tpavel: and where/how do you call it?
[07:20:17] _tpavel: joy4u, so your task is actually inside the "namespace :deploy" block?
[07:21:34] _tpavel: joy4u, good then I think you only need to wrap your if-else inside another "on roles(:db) do" block
[07:22:08] _tpavel: because the 'run' and 'execute' methods are out of scope otherwise
[07:22:50] _tpavel: even the simple task on the homepage: http://capistranorb.com/ has another block inside it with "on :roles"
[07:24:47] _tpavel: joy4u, this: https://gist.github.com/tudorpavel/285cdf2105205fe27400
[07:34:12] _tpavel: joy4u, did that work?
[07:43:45] _tpavel: http://lmgtfy.com/?q=capistrano+check+if+file+exists :) I've never done it, so good luck!
[08:38:34] _tpavel: din anyone here receive an EOFError while trying to use a private SMTP server for Action Mailer? Is it a problem with the SMTP server?


[06:31:24] _tpavel: especially if you created a special route for the search
[06:40:37] _tpavel: Gandora, you don't need that 'f'. Use radio_button_tag helper instead.
[06:41:36] _tpavel: or wait, pontiki is right, they aren't even inside the search form
[06:45:25] _tpavel: when submitting the search form?
[08:07:37] _tpavel: just curious, did anyone here do any ruby work related to the type of news clustering that Google News does?


[13:47:04] _tpavel: hackeron, what's with the ":"?


[15:46:35] _tpavel: URGENT: I'm in a competition and I need help using a gemset in RVM
[15:46:42] _tpavel: I'm trying to use rmagick
[15:47:27] _tpavel: and when I put require 'rubygems' and require 'rmagick' it says it can't find rmagick. It's installed in the current gemset
[15:48:31] _tpavel: I'm really on the clock with this one
[15:49:04] _tpavel: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
[15:49:29] _tpavel: ruby-2.1.1@ccc
[15:49:51] _tpavel: https://gist.github.com/tudorpavel/bc0edec82c97544357b4
[15:51:24] _tpavel: and I'm using it like this: https://gist.github.com/tudorpavel/2ddd6db0d1bce4e134a9
[15:51:30] _tpavel: with running "ruby blabla.rb"
[15:52:43] _tpavel: https://gist.github.com/tudorpavel/e44d0117687d95e902d6
[15:53:23] _tpavel: Ubuntu 14.04


[15:00:18] _tpavel: hey guys, anyone know if I can have two :format validations that both need to pass? It's not working for me
[15:20:47] _tpavel: rushed, okay here is a gist: https://gist.github.com/tudorpavel/a59e11276cebddf3ca8b
[15:21:08] _tpavel: basically, I want the error messages to be mutually exclusive
[15:22:34] _tpavel: also leaving just the second Regex doesn't help, because I need the first character to be a letter
[15:26:22] _tpavel: i know, i know, I thought the same thing when I saw these requirements from the client...
[15:29:21] _tpavel: workmad3, I totally agree with you, but unfortunately I'm not yet in a position to tell them to get lost
[15:30:26] _tpavel: of course and we'll keep telling them :)
[15:31:29] _tpavel: rushed, thanks. I didn't think to write two validation statements. i don't care about mutually exlusive that much
[15:32:03] _tpavel: haha, that's always an option if I get even more mad :D


[16:48:16] _tpavel: bobson1234, what do you mean speech marks?


[08:03:51] _tpavel: Hi, does ActiveRecord have some helpers for using the SQL ALL syntax? http://technet.microsoft.com/en-us/library/ms187074(v=sql.105).aspx
[08:05:00] _tpavel: I'm looking for the most beautiful way of querying Items which belong to ALL Categories specified in an array.
[08:06:32] _tpavel: luckyruby, I know, but I was leaving that as a last resort
[08:08:16] _tpavel: The relationship between the models is of course: Item belongs_to Category and Category has_many Items
[10:24:23] _tpavel: does anyone know if you can use Squeel to define a Custom Ransack Predicate?


[15:19:17] _tpavel: hi, did anyone try recently to install a staging/prod server with Capistrano 3, RVM and foreman export to upstart?


[16:34:16] _tpavel: does anyone have any idea why a simple migration modifies the schema.rb deleting "null: false" from many "created_at" and "updated_at"?
[16:34:35] _tpavel: from other random tables ofc


[11:25:16] _tpavel: timmi_qt, I think you should save mat before doing mat.probes
[11:25:23] _tpavel: because mat.probes goes to the DB
[11:26:24] _tpavel: it's not, because it needs an id for mat
[11:26:37] _tpavel: and it only gets that from saving to the DB
[11:27:47] _tpavel: yes, ActiveRecord maps the database table entry into an object
[11:30:06] _tpavel: timmi_qt, can you add to the gist a snippet of code where you're using the models?
[11:32:31] _tpavel: lxsameer, the routes of course: http://guides.rubyonrails.org/getting_started.html#getting-up-and-running
[11:32:36] _tpavel: basically, every HTTP request is translated through the routes and calls a controller method
[11:33:24] _tpavel: you can see on the guides link i pasted, it says the routes file is in config/routes.rb
[11:35:00] _tpavel: lxsameer, oh, sorry. I'm not sure about the internals.


[08:09:36] _tpavel: timmi_qt, it's usually a good idea to avoid regexes, but if you find yourself in a situation where you have to use them http://rubular.com/ is a great tool for fiddling around with them


[08:56:18] _tpavel: Hi, if I have a string of words separated by commas "foo,bar,baz" how would I concisely and beautifully remove one word from the string?
[08:56:55] _tpavel: I need a method that works for "foo", "bar" and "baz" in my example
[09:00:23] _tpavel: apeiros, thanks. I tried with slice, but it's no good. I think I'll try with split+delete+join
[09:12:04] _tpavel: Ok, two problems: 1) delete returns the deleted element and this means I can't chain them and 2) If I remove a middle word, two commas remain next to each other
[09:12:38] _tpavel: sorry, 2 is not a problem, ignore that :)
[09:14:03] _tpavel: but it's weird in the docs, the beginning examples show that #delete returns the remaining array: http://www.ruby-doc.org/core-2.0.0/Array.html#class-Array-label-Removing+Items+from+an+Array
[09:14:44] _tpavel: while at #delete it shows it returns the removed item
[09:14:45] _tpavel: http://www.ruby-doc.org/core-2.0.0/Array.html#method-i-delete
[09:17:45] _tpavel: for 2.1, they've fixed the API doc for this
[09:18:43] _tpavel: hehe, yep :)
[09:19:33] _tpavel: but changing the return value of delete doesn't allow chaining like I need. It's a weird decision...
[15:19:37] _tpavel: you should try ActiveRecord queries in rails console and build them one step at a time to see what everything outputs and especially what type


[08:29:13] _tpavel: who's comparing a language with a framework? xD


[14:56:01] _tpavel: i don't think "belongs_to" does anything in a migration
[14:56:29] _tpavel: loc22, read up on migrations and associations at guides.rubyonrails.org
[14:58:40] _tpavel: oh, I see. So it adds the needed foreign key in the DB
[15:00:59] _tpavel: if you want to do something like order.customer you need to have "belongs_to :customer" in the model too
[15:01:42] _tpavel: that's the way ActiveRecord knows to define the #customer method
[15:02:07] _tpavel: and of course it needs to have customer_id field in the orders table in the DB
[15:02:30] _tpavel: which is created by "t.belongs_to :customer", as zv1n pointed out
[15:03:37] _tpavel: yep, good luck! :)


[11:31:44] _tpavel: hi, has anyone used Digital Ocean + Dokku to deploy to production? I'm looking for a heroku-easy but more affordable deployment setup.
[11:34:12] _tpavel: yeah, I know... it's the only way I have deployed so far but I'm worried about venturing on with my product and I need more dynos but don't have the revenue
[11:35:29] _tpavel: thin for now, but I've been looking at alternatives and unicorn seems a good choice
[11:37:31] _tpavel: uuu, nice one
[11:38:00] _tpavel: thanks rushed for the post ;) i'll definitely give it a try
[11:40:08] _tpavel: elaptics, just curious what is your favorite choice when it comes to deployment to production?
[11:44:12] _tpavel: elaptics&rubyracer: and how would you say your choices are in terms of ease of first time configuration?
[11:45:14] _tpavel: because it seems to me that a not so experienced person (like me) could easily spend days making it work
[11:46:13] _tpavel: cool, I thought as much. :)
[11:47:53] _tpavel: rubyracer, I was just doing that
[11:51:21] _tpavel: elaptics, rubyracer: Thanks guys! I've got way more options now. :D


[08:57:58] _tpavel: I inherited a Rails 3.2 app which has a /config/application.yml file. The recommended host is "localhost:8080", but I want to run it with port 3000. If I change it in application.yml, all is well, except for image_path which outputs a link with 8080 to the final CSS.
[08:58:05] _tpavel: Where could there be an extra config for this?
[09:03:15] _tpavel: any ideas to my question? It's really driving me crazy...


[19:36:02] _tpavel: @pontiki is it something you really need to automate?
[19:38:09] _tpavel: @pontiki I've never tried that before. You're referring to the production database I suppose?
[19:41:05] _tpavel: I see, did you try to just set the environment with that copy db in spec_helper?
[19:41:25] _tpavel: and then do your thing
[19:43:58] _tpavel: that's what I wanted to say. Watch out what tests you run in that environment
[19:46:08] _tpavel: ctrl+R in your browser? :P
[19:52:44] _tpavel: amh345, are you using rails 3.2?
[20:00:28] _tpavel: Criten, wow...
[20:01:30] _tpavel: haha, i think your sql level went over 9000 after that one
[20:05:21] _tpavel: amh345, I think your problem is that you're modifying the params after you've created the @customer
[20:06:11] _tpavel: try to move the Customer.new after the each block
[20:10:41] _tpavel: amh345, no prob
[20:21:08] _tpavel: i keep hearing/seeing people using python for random automation and stuff. Why is is better than say Ruby?
[20:23:33] _tpavel: BTW, I have an open question: what's the quirkiest thing you did with Ruby?
[20:30:17] _tpavel: or: brutus = ->(caesar) { betray }