zrl

Activity Graph

Page 1 of 3 | Next »

2018-01-03

[14:12:49] zrl: K-Lined

2018-01-01

[21:56:34] zrl: has joined #RubyOnRails
[21:57:04] zrl: Hi friends, is there a way to make a has_many association read only?
[21:57:18] zrl: I know I can make models read only, but I'm still able to modify their associations after calling readonly!.

2016-07-27

[06:49:29] zrl: Ping timeout: 250 seconds
[06:52:30] zrl: has joined #ruby
[06:52:33] zrl: has joined #RubyOnRails

2016-07-19

[14:30:50] zrl: Max SendQ exceeded
[14:34:20] zrl: has joined #ruby
[14:34:22] zrl: has joined #RubyOnRails

2016-07-18

[17:05:44] zrl: Ping timeout: 272 seconds
[17:14:02] zrl: has joined #ruby
[17:14:04] zrl: has joined #RubyOnRails

2016-04-15

[15:12:40] zrl: Ping timeout: 260 seconds
[15:42:24] zrl: has joined #ruby
[15:42:36] zrl: has joined #RubyOnRails
[17:27:51] zrl: *.net *.split

2016-04-07

[03:09:20] zrl: I have a model with a Rails 4 enum in it. What's the recommended strategy for adding a new field to the beginning of that enum?
[03:10:07] zrl: ex. i want to go from `enum year: [:freshman, :sophomore, :junior, :senior]` to `enum year: [:below_high_school, :freshman, :sophomore, ...]`
[03:10:33] zrl: sevenseacat: it's an array
[03:10:40] zrl: i'd like to convert it to a hash mapping though
[03:11:18] zrl: okay, you're the best. thanks
[03:11:43] zrl: i was previously crashing active record when i tried converting it to a hash map, but i figured that part out now
[03:27:11] zrl: eh, i'm in the rbenv boat
[03:27:18] zrl: joshhbk: have you checked out docker-compose?
[03:27:29] zrl: if you're already on the docker bandwagon, it may be a good choice
[03:27:37] zrl: i use it for all ruby development

2016-02-16

[23:38:43] zrl: *.net *.split

2016-02-01

[05:49:34] zrl: *.net *.split

2016-01-31

[12:25:26] zrl: *.net *.split
[12:28:19] zrl: has joined #RubyOnRails
[12:28:23] zrl: has joined #ruby

2016-01-13

[18:08:51] zrl: K-Lined
[18:30:53] zrl: has joined #ruby
[18:31:06] zrl: has joined #RubyOnRails

2016-01-02

[00:00:53] zrl: Ping timeout: 240 seconds

2015-12-13

[10:25:11] zrl: Ping timeout: 260 seconds
[10:45:37] zrl: has joined #ruby
[10:45:50] zrl: has joined #RubyOnRails
[18:06:08] zrl: Ping timeout: 240 seconds
[18:10:05] zrl: has joined #ruby
[18:10:18] zrl: has joined #RubyOnRails

2015-12-02

[15:37:20] zrl: *.net *.split
[15:41:33] zrl: has joined #ruby
[15:41:46] zrl: has joined #RubyOnRails
[15:53:26] zrl: *.net *.split
[16:47:49] zrl: has joined #ruby
[16:48:06] zrl: has joined #RubyOnRails
[19:59:18] zrl: Remote host closed the connection
[20:17:35] zrl: has joined #ruby
[20:17:48] zrl: has joined #RubyOnRails

2015-11-30

[00:06:48] zrl: Ping timeout: 264 seconds
[00:08:39] zrl: has joined #ruby
[00:08:46] zrl: has joined #RubyOnRails
[02:00:49] zrl: Ping timeout: 264 seconds
[02:08:35] zrl: has joined #ruby
[02:08:46] zrl: has joined #RubyOnRails
[05:48:54] zrl: Ping timeout: 245 seconds
[10:58:10] zrl: has joined #ruby
[10:58:23] zrl: has joined #RubyOnRails

2015-11-27

[00:04:38] zrl: has joined #RubyOnRails
[00:04:39] zrl: has joined #ruby
[10:34:48] zrl: *.net *.split
[10:42:49] zrl: has joined #ruby
[10:42:49] zrl: has joined #RubyOnRails
[10:43:08] zrl: Max SendQ exceeded
[10:47:05] zrl: has joined #RubyOnRails
[10:47:05] zrl: has joined #ruby

2015-11-26

[08:10:55] zrl: has joined #ruby
[08:11:08] zrl: has joined #RubyOnRails
[08:24:43] zrl: has joined #ruby
[08:24:43] zrl: has joined #RubyOnRails
[08:24:43] zrl: Changing host
[16:35:36] zrl: Ping timeout: 240 seconds
[23:54:14] zrl: *.net *.split

2015-11-22

[03:45:02] zrl: *.net *.split

2015-11-21

[17:45:06] zrl: Ping timeout: 240 seconds
[17:48:36] zrl: has joined #ruby
[17:48:49] zrl: has joined #RubyOnRails

2015-11-11

[16:17:08] zrl: Ping timeout: 240 seconds

2015-11-08

[02:41:36] zrl: Remote host closed the connection
[12:47:03] zrl: has joined #ruby
[12:47:16] zrl: has joined #RubyOnRails

2015-10-16

[00:13:38] zrl: has joined #ruby
[00:13:46] zrl: has joined #RubyOnRails

2015-10-06

[20:43:45] zrl: *.net *.split
[20:58:53] zrl: has joined #ruby
[20:59:07] zrl: has joined #RubyOnRails
[22:22:33] zrl: Remote host closed the connection

2015-10-03

[22:11:36] zrl: Ping timeout: 268 seconds
[22:14:57] zrl: has joined #ruby
[22:15:11] zrl: has joined #RubyOnRails

2015-09-25

[00:04:49] zrl: has joined #ruby
[00:05:03] zrl: has joined #RubyOnRails

2015-09-24

[23:56:06] zrl: Ping timeout: 240 seconds

2015-09-22

[07:41:35] zrl: K-Lined
[09:52:24] zrl: has joined #ruby
[09:52:37] zrl: has joined #RubyOnRails

2015-07-30

[15:29:23] zrl: Remote host closed the connection
[16:20:33] zrl: has joined #ruby
[16:20:48] zrl: has joined #RubyOnRails

2015-07-26

[00:50:48] zrl: has joined #ruby
[00:51:03] zrl: has joined #RubyOnRails

2015-07-20

[05:36:19] zrl: Ping timeout: 240 seconds
[06:05:31] zrl: has joined #ruby
[06:05:46] zrl: has joined #RubyOnRails

2015-07-16

[03:47:49] zrl: Ping timeout: 264 seconds
[04:23:21] zrl: has joined #ruby
[04:23:36] zrl: has joined #RubyOnRails

2015-06-21

[00:11:22] zrl: has joined #ruby
[00:11:37] zrl: has joined #RubyOnRails
[00:36:32] zrl: Ping timeout: 246 seconds

2015-06-20

[20:59:31] zrl: *.net *.split

2015-06-09

[03:07:53] zrl: Write error: Broken pipe
[06:34:38] zrl: has joined #ruby
[06:34:54] zrl: has joined #RubyOnRails

2015-06-03

[02:27:01] zrl: has joined #ruby
[02:27:17] zrl: has joined #RubyOnRails

2015-06-02

[01:36:05] zrl: Read error: Connection reset by peer
[01:42:35] zrl: has joined #ruby
[01:42:51] zrl: has joined #RubyOnRails
[22:08:42] zrl: Ping timeout: 276 seconds
[22:58:31] zrl: has joined #ruby
[22:58:47] zrl: has joined #RubyOnRails

2014-11-13

[20:20:07] zrl: are there any popular implementations of mailing lists out there that i could learn from?
[20:20:13] zrl: *in rails
[20:25:48] zrl: alexggordon: just found that, anything else you know of?
[20:25:56] zrl: difficult to google for, finding lots of rails mailing lists
[20:29:16] zrl: i should have been more clear in my original ask - i'm looking for example mailing list implementations in rails (zlist looks fine for this) to base one off of that i'm going to build. not looking for mailchimp.
[22:46:46] zrl: what do people use these days for authorization?
[22:47:11] zrl: ???? thanks!

2014-11-04

[23:42:47] zrl: I have some text with new lines in it. Something along the lines of "Lorem\nipsum". I'd like to create a regex to check whether that text matches the string "Lorem ipsum". It's currently not matching due to the new lines.
[23:43:49] zrl: jenrzzz: i have that. to my understanding, that allows . to match newlines as well as any character.
[23:44:07] zrl: zenspider: right. what's an example regex that would allow newlines or spaces in the string?
[23:45:41] zrl: zenspider: thanks! bookmarked, had no idea that existed and it looks super useful. thanks for putting that together!
[23:47:24] zrl: jenrzzz: rubular is awesome! i should have been far clearer in my original question, but i do appreciate you bringing it up again.

2014-10-30

[02:35:34] zrl: what's the recommended way to deal with page-specific javascript? like loading and initializing a google map?

2014-09-27

[00:32:24] zrl: /join #coreos

2014-09-26

[01:06:22] zrl: How can I create an uninitialized local variable?
[01:06:32] zrl: Is var_name = nil the best way?

2014-09-25

[21:18:21] zrl: Is there any easy way to loop with an iteration every x increment of time?
[21:18:39] zrl: Ideally something like 5.minutes { puts "Hi!" }
[21:18:45] zrl: And have that run every 5 minutes.
[21:18:48] zrl: Don't want a cronjob.
[22:52:22] zrl: What's an easy way to get a block of code to run at a set interval? I'd like to the syntax to be something like 1.minutes { puts "Hello, world!" }

2014-07-10

[04:26:33] zrl: @shellox

2014-07-09

[04:40:50] zrl: Is there some sort of helper that'd shorten line 11? https://gist.github.com/zachlatta/a5ea7f0241139c729f53#file-devices_spec-rb-L11
[04:42:53] zrl: Ideally I could replace it with something like `format: :json` so I don't have to write { 'CONTENT_TYPE' => 'application/json' } in nearly every test case for my API. If not, that's fine though.
[04:45:35] zrl: bricker`LA: when I do that (see second file at https://gist.github.com/zachlatta/a5ea7f0241139c729f53, i may be doing it wrong), i get the error "ActionController::ParameterMissing - param is missing or the value is empty: device". to my understanding, that's because the Content-Type: application/json header isn't correctly added and wrap_parameters in the controller doesn't think it's in json format and doesn't correctly put it into the params['device'] value
[04:47:13] zrl: just added it to the gist, refresh
[04:47:30] zrl: the wrap_parameters and skip_before_action will be refactored into an ApiBaseController after i get this working
[04:50:29] zrl: specifying the key doesn't work either, and posting manually from outside the application with the Content-Type: application/json header works fine
[04:52:58] zrl: with { format: :json } the Content-Type is application/x-www-form-urlencoded. with { 'CONTENT_TYPE' => 'application/json' }, the Content-Type is application/json
[05:15:24] zrl: Is it possible to do something like ActiveRecord::Store, but for all of the attributes of a model? http://api.rubyonrails.org/classes/ActiveRecord/Store.html
[05:15:56] zrl: I'd like to create a Preferences model that has all of its attributes serialized to a single column in the database.
[05:16:08] zrl: s/to a single column/as JSON to a single column
[05:19:36] zrl: Ah, got it figured out.
[05:19:58] zrl: rvanlieshout: i didn't, but that's definitely one way to do it
[05:30:00] zrl: Order by mail, using a personal check drawn on a US bank payable in US Dollars
[05:30:05] zrl: love it
[05:39:25] zrl: it's secure
[05:41:49] zrl: ^ and files
[21:23:15] zrl: Is it possible to only create the preferences model in the relationship if it's nil? Line 2 of https://gist.github.com/zachlatta/c168e757851569647cec#file-device-rb-L2 throws "method missing: undefined method `preferences`"
[22:05:57] zrl: How can I check if an association exists in a model from the model's class itself? I have a Device model that has_one :preferences. On before_create, I want to run :create_preferences, unless preferences is present.
[23:30:17] zrl: Is it possible tosee what's causing ActiveRecord::RecordNotSaved?

2014-07-07

[16:48:04] zrl: I'm having trouble getting Rails to load a gem I just installed. It's in my Gemfile and Gemfile.lock, but my initializer for the gem in config/initializers/push_io.rb fails with a NameError. Here's a gist: https://gist.github.com/zachlatta/cc378193b978efb30d85. Any ideas?
[16:49:18] zrl: Argh, irssi just completeley glitched out. Not sure if my last message sent. Here it is again: I'm having trouble getting Rails to load a gem I just installed. It's in my Gemfile and Gemfile.lock, but my initializer for the gem in config/initializers/push_io.rb fails with a NameError. Here's a gist: https://gist.github.com/zachlatta/cc378193b978efb30d85. Any ideas?
[16:50:27] zrl: w0bni: What about Hero(has_many :games) and Game(belongs_to :hero)
[16:50:44] zrl: That way you get Hero.games and Game.hero
[16:56:29] zrl: bahar: it depends on your application. if the users are very similar, i'd write similar tests in the same file, but with different contexts. if they are very different, i'd seperate it out and make heavy use of rspec helpers.
[16:59:02] zrl: bahar: are you managing roles manually? or using something like pundit?
[17:01:32] zrl: bahar: i personally do http://thunderboltlabs.com/blog/2013/03/27/testing-pundit-policies-with-rspec/ for testing pundit
[17:02:37] zrl: well, i modified that article a bit for my use case, but that same general concept
[20:49:27] zrl: How can I create a different primary key for a single model?
[20:50:12] zrl: For all of my models, the id integer field is the primary key. For one model I want to have a guid be the primary key.
[20:54:17] zrl: rhizome: the alternative is to have a guid field and index that and create routes from that. is it possible to have the parameter in a `resouces :model` be something other than id? like have it passed into the controller as params[:guid]?
[21:05:32] zrl: Thanks! To give a bit of background, I have a device model with a UUID field that's unique and used to identify the device. I want to query devices by their UUID, like GET /users/2def69c3-7f04-4e49-a7a6-7c963f169fcd. Should I make the UUID column a primary key, or should I index it and in my controller query for devices with User.find_by(uuid: '2def69c3-7f04-4e49-a7a6-7c963f169fcd') and use to_param to make Rails spit out routes with the UUID?
[21:06:45] zrl: smathy: I have it for other models in the DB, but I haven't created this model yet.
[21:08:34] zrl: Alright, awesome. Thanks.

2014-07-06

[00:49:24] zrl: mozzarella: first result google https://www.google.com/search?q=favicon+rails&oq=favicon+rails :/
[00:50:12] zrl: your browser's cache may need a refresh
[00:50:19] zrl: does it work in an incognito window?
[01:13:35] zrl: mozzarella: what format is the favicon in
[04:00:26] zrl: zelrik: did you declare a range?
[04:00:40] zrl: <%= @comments.each do |comment| %>
[04:01:10] zrl: can i see your view code
[04:01:51] zrl: ah, i misunderstood you
[04:03:34] zrl: what is the partial called?
[04:03:40] zrl: collectionproxy is the correct type
[04:04:33] zrl: this shouldn't be causing the issue, but it should be _comment.html.erb
[04:05:17] zrl: yeah, just saying
[04:05:28] zrl: you also get the helper <%= render @comments %>
[04:08:21] zrl: what happens if you render the partial and pass in one of the comments directly?
[04:09:00] zrl: i'm curious to see if it works without the collection
[04:10:09] zrl: you can also copy to your system register (") from vim
[04:10:52] zrl: select the text you want in visual mode, press ", and then press y
[04:11:15] zrl: oh wait, my bad
[04:11:18] zrl: it's the * register
[04:11:26] zrl: so select the text in visual mode, press ", press *, then press y
[04:11:50] zrl: vim has to be compiled with system register support though, and it may not be * on your system
[04:12:04] zrl: anyways
[04:13:30] zrl: that'd do it
[04:13:38] zrl: so the name of the partial corresponds to the name of the partial
[04:13:45] zrl: so it does have to be _comment.html.erb
[04:13:55] zrl: will do
[04:14:25] zrl: ah, tired, my bad. the name of the local variable corresponds to the name of the partial.
[04:14:28] zrl: http://stackoverflow.com/questions/15149365/rails-rendering-collection-not-working-undefined-local-variable-or-method
[04:17:02] zrl: yup, it's an issue with frameworks in general. with abstraction comes ambiguity and misunderstanding.
[04:19:15] zrl: sinatra is nice, much more my style. i've been playing around with go recently and been enjoying it.
[04:32:16] zrl: zastern: yeah, it is. i've had success using it for websites/web services as well.
[04:32:39] zrl: the standard library + gorilla (popular web toolkit) is similar to sinatra
[05:00:05] zrl: zastern: comment_params is likely a private method at the bottom of the controller
[05:00:34] zrl: zastern: it probably has something like params.require(:xyz)
[05:48:51] zrl: to answer your question directly
[05:49:01] zrl: if you really just want to select employees where age is not null
[05:49:18] zrl: Employee.where('age is not null').pluck('age') will be faster because it's done in sql
[05:50:30] zrl: zastern: what's causing it?
[05:52:05] zrl: zastern: ah, yes. you have to do params.require for all of the fields you want
[05:52:43] zrl: since that's in the CommentsController, you should do @comment = current_user.comments.new(comment_params)
[05:53:43] zrl: anyways, SO question that solves this problem http://stackoverflow.com/questions/17450185/forbidden-attributes-error-in-rails-4-when-encountering-a-situation-where-one-wo
[07:12:53] zrl: i've created a user model and a mechanism for log in. how can i specify a different root route if a user is logged in? i'm not using devise.
[07:13:37] zrl: similar to how devise has authenticated :user do
[07:14:06] zrl: rushed: doesn't rails default to the first route in routes.rb if there are duplicates?
[07:14:28] zrl: essentially i'm asking how to conditionally apply routes
[07:16:46] zrl: rushed: ah, alright. i'm assuming recreating this method in my application isn't a good idea then? https://github.com/plataformatec/devise/blob/395b5c4237393a88e5b00c653b52eb74ff603e95/lib/devise/rails/routes.rb#L295
[07:20:29] zrl: alright, i think i know of an alternative. thanks!

2014-07-04

[05:36:03] zrl: i'm building a view with jbuilder. is there a way to not render the "description" field at all if it's null? https://gist.github.com/zachlatta/b45352da50542776cfde

2014-07-03

[20:16:59] zrl: rails_nubyist: yeah, there are a few other fields as well that i don't want to store, but that serves well as an example
[20:25:01] zrl: rails_nubyist: it's a bash thing, you need to escape the bank
[20:26:13] zrl: rails_nubyist: so when i pass in attributes that the model doesn't save to the db, but my after_create method requires, i get the error ActiveRecord::UnknownAttributeError with the message unknown attribute: my_attribute
[20:27:59] zrl: i think a virtual attribute is what i'm looking for
[20:40:24] zrl: rails_nubyist: what does running echo \!TEST in bash echo?
[20:42:41] zrl: rails_nubyist: just use single quotes echo 'this is !123 my password'
[20:44:27] zrl: rails_nubyist: do be careful for dictionary attacks