FrostCandy

Activity Graph

Page 1 of 3 | Next »

2019-02-23

[07:37:30] FrostCandy: has joined #RubyOnRails
[07:37:30] FrostCandy: has joined #ruby
[07:46:40] FrostCandy: has joined #RubyOnRails
[07:46:40] FrostCandy: has joined #ruby
[07:47:11] FrostCandy: has joined #RubyOnRails
[07:47:11] FrostCandy: has joined #ruby

2019-01-12

[17:37:24] FrostCandy: has joined #RubyOnRails
[17:37:24] FrostCandy: has joined #ruby
[17:39:25] FrostCandy: im using a gem called like this gem::method.where(state: 'ny') and if I type it like that it works, but I have a hash called parameters and add state like this parameters[:state] = 'ga' then I pass the hash but it doesnt work. How can I pass a hash properly to the gem method?
[17:40:07] FrostCandy: I tried turning the hash into a string, so the variable holds a string like state: 'ny', but that doesnt work because I assume state: isn't sent as a symbol?
[17:40:36] FrostCandy: I guess what I need to do is turn my has into a set of symbols and strings
[17:53:35] FrostCandy: ianfleeton: nope, thta's essentiall what I was doing. so far i tied sending parameters, pareameters.to_json, parmeters.to_s and even running it through a loop to create state: 'ga'
[17:53:48] FrostCandy: only thing that works is by manually typeing the symbol and value so far :(
[17:54:17] FrostCandy: maybe pareameters is a reserved variable heh i'll try to change that variable name.
[17:56:42] FrostCandy: Iambchop: omg it was the word parameters lol, i changed it to pvar = {} and so on, works fine
[17:56:54] FrostCandy: maybe it's a ruby on rails issue not ruby
[18:03:17] FrostCandy: phaul dont use double colons here? or you mean for calling the gem and method?
[18:12:26] FrostCandy: Iambchop: ok thanks, we're using an old version of ruby so I don't know if things were diff back when they designed it, but good to know.
[18:16:02] FrostCandy: OpenStates is the gem and ruby 2.1
[19:25:30] FrostCandy: phaul: it was response = OpenStates::Legislator.where(state: 'ga') So I guess that is the Openstates Modual, the Legilator class and the where method? Yup terminology problem on my end.
[19:44:32] FrostCandy: phaul: ya, my bad

2018-09-10

[21:15:13] FrostCandy: has joined #RubyOnRails
[21:15:13] FrostCandy: has joined #ruby

2018-07-29

[19:26:37] FrostCandy: has joined #RubyOnRails
[19:26:37] FrostCandy: has joined #ruby
[19:27:28] FrostCandy: What happens when you say if variable? , does that check to see if the variable exists? I can't find a def variable? method anywhere so it must be built in to ruby?
[19:28:08] FrostCandy: if variable? is just a boolean true false check ?
[19:42:03] FrostCandy: ciro: thanks

2018-06-23

[21:24:03] FrostCandy: has joined #RubyOnRails
[21:24:03] FrostCandy: has joined #ruby
[21:25:42] FrostCandy: Hello, im using ActiveRecord and we have a validates section, but i have one part of my form that may or may not need validation based on another element of my object. Can i use if statments around the validates clause ?

2018-05-19

[15:39:55] FrostCandy: has joined #ruby
[15:40:16] FrostCandy: has joined #RubyOnRails
[15:41:03] FrostCandy: Hello, is therer a command i can use to see all accessable variables? I need to know what @vars I can access from a method. Something like puts @vars_avail
[15:42:31] FrostCandy: tbuehlmann: haha nice thanks
[15:43:07] FrostCandy: is the use just puts #instance_variables ?
[15:43:10] FrostCandy: trying it now
[15:45:10] FrostCandy: oh ok thanks agaon

2018-05-02

[13:55:52] FrostCandy: has joined #RubyOnRails
[13:55:52] FrostCandy: has joined #ruby
[13:57:32] FrostCandy: I have a form with a couple of differnt submit options, the normal submit handled the required fields f.field required, but is there a way to make my onClick alternative button trigger the rails form check before i continue with my alterior javascript routine? Or do i need to code my own.
[15:50:21] FrostCandy: Remote host closed the connection
[15:50:47] FrostCandy: has joined #RubyOnRails
[15:50:47] FrostCandy: has joined #ruby
[15:55:13] FrostCandy: Ping timeout: 248 seconds
[17:04:08] FrostCandy: has joined #ruby
[17:04:09] FrostCandy: has joined #RubyOnRails

2018-05-01

[20:36:45] FrostCandy: has joined #RubyOnRails
[20:36:45] FrostCandy: has joined #ruby
[20:38:43] FrostCandy: Tried everything i could think. After getting a response from 3rd party i need to verify they sent me the array keys I expect. if (r.key?('one') && r['one'].key?('two') ) does not work. That should verify that r['one']['two'] exists.
[21:17:43] FrostCandy: yebyen: hey thanks, just reading this. I could use try sure, but dig is probably what i want I'll have to check.

2018-04-30

[18:30:21] FrostCandy: has joined #RubyOnRails
[18:30:21] FrostCandy: has joined #ruby
[18:31:50] FrostCandy: is there a way to add an or to a .exist() ? Thing.exists(id: 10, action: nil || action: 0)
[18:31:58] FrostCandy: exists?() i mean
[18:46:34] FrostCandy: nzst: yup that did work. Elegant solution.

2018-04-24

[15:51:21] FrostCandy: has joined #RubyOnRails
[15:51:21] FrostCandy: has joined #ruby
[15:54:18] FrostCandy: You know when you def params that you allow at the bottom of a page? Well if i send a string type then it works, but I have a checkbox sending an array ["one","two"] and my variable ends up being nil even when data is being sent to that parameter.
[16:07:19] FrostCandy: Ah params.permit(:id => [])
[16:14:46] FrostCandy: dang ruby has so many gotcha's. ^^ that needs to be at the end of the permitted parmms lol
[16:14:54] FrostCandy: well rails, not ruby i guess
[16:45:01] FrostCandy: Is this an accurate hardware analogy for fixing someone else's code? https://tinyurl.com/ydcujhzm
[17:36:32] FrostCandy: When I print <%= @db.myvar %> I get [&quot;myvar&quot;] instead of ["myvar"] which is messing up my javascript. Is there a way to print my variable with quotes instead of with the &quot; safe ?
[17:38:25] FrostCandy: hmmm that worked.

2018-04-18

[20:19:47] FrostCandy: has joined #RubyOnRails
[20:19:47] FrostCandy: has joined #ruby
[21:08:09] FrostCandy: I have a nested_form_for with some radio buttons and textboxes, I want to add a checkbox but it doesn't apply to any database field so I cant use :fieldname I want to do something like, f.check_box "My Text", "MyValue"
[21:35:22] FrostCandy: nm figured it out :)

2018-04-10

[19:37:16] FrostCandy: has joined #RubyOnRails
[19:37:16] FrostCandy: has joined #ruby
[19:38:09] FrostCandy: I have redirect_to edit_org_url(@org), i want it to go to https:// though. When it redirects it only goes to http :(
[19:39:02] FrostCandy: I guess i cna use a full url

2018-04-04

[21:14:39] FrostCandy: has joined #RubyOnRails
[21:14:39] FrostCandy: has joined #ruby
[21:15:27] FrostCandy: Easy Question, I need to see if this date is older than a year old. This timestame looks like this 2018-04-04 18:45:31.079599
[21:15:59] FrostCandy: I think i want something like this but it doesnt work Date.today - 365 <= Date.parse(created_at, "%d-%m-%Y")
[21:16:03] FrostCandy: probalby cause i got the wrong format
[21:30:31] FrostCandy: oh ok thanks couldnt find that easily
[21:31:48] FrostCandy: undefined method `downcase' for Thu, 26 Oct 2017 21:08:05 UTC +00:00:Time
[21:31:50] FrostCandy: i got this :(
[21:32:15] FrostCandy: if Date.today - 365 <= Date.parse(vemail.created_at)
[21:32:20] FrostCandy: ^^ Thats my line that breaks
[22:03:41] FrostCandy: dionysus69: by the way turns out reading the date in from postgres through activerecords automaticalyl puts it into a date class so i was trying to to_date a date heh
[22:31:00] FrostCandy: conorao: yup it turned out i didn't have to mess with the returend date from the db. It was already a date type.

2018-03-27

[17:23:06] FrostCandy: has joined #RubyOnRails
[17:23:06] FrostCandy: has joined #ruby
[17:24:52] FrostCandy: so i run a o = Table.where(:id => 1), then o.field = "hi", then o.save. I get an error undefined method field= for table::ActiveRecord_Reltion
[17:25:24] FrostCandy: whats wrong with assinging o.field = a string? my database has the field , should work
[17:25:53] FrostCandy: if i inspect o, it shows field nil
[17:26:01] FrostCandy: because nothing is in it yet of course
[17:33:27] FrostCandy: oh thats intersting adding a [0] or .first to my where call is probably whats going on here.
[17:33:57] FrostCandy: yup, should have guessed where would return an array.

2018-03-21

[13:18:12] FrostCandy: has joined #RubyOnRails
[13:18:12] FrostCandy: has joined #ruby
[13:21:01] FrostCandy: we are using devise to handle login apparently, we have a logout link like main_app.destroy_user_session_path, I can't find a main_app controller or a user_session or session controller, what controller am i supposed to be looking for so I can see wheere main_app is? I added a bann user to the db and when someone logs in i want to check if they are banned then log them out
[13:28:03] FrostCandy: Hmm ok so i'd have to modify the gem in order to check vs bann ? Actually I might be able to find a piece of code that is run when a user attempts login and handle it there.
[13:33:40] FrostCandy: well everyone hts the index page after logging in, so i can do a IF user_logged_in? , then check thier bann, then log them back out.
[13:34:47] FrostCandy: ah ok thanks
[13:35:12] FrostCandy: didn't realize it was documented like this
[16:06:36] FrostCandy: What does it mean if I make a method in a class that srtarts with _ ? Does that make it a private method or anything special?
[16:30:16] FrostCandy: Apparently the underscore in method name is just garnish. I am using a mailer controller class class EmailBlastMailer < AsyncApplicationMailer, and if I didn't put .deliver! at the end of my call to a def it wouldn't even run the method at all. I would have understood if it didn't mail, but didn't expect it no to run the method at all. I guess that's something written into the parent AsyncApplicationMailer
[19:59:24] FrostCandy: has joined #ruby
[19:59:25] FrostCandy: has joined #RubyOnRails

2018-03-20

[16:20:25] FrostCandy: has joined #RubyOnRails
[16:20:25] FrostCandy: has joined #ruby
[16:22:44] FrostCandy: Anyone know why my gem would work on my local system but not on my production server? I'm new to ruby so probably something easy. when i do GEM LIST i get zeroclipboard-rails (0.1.2) but in my Gemfile it shows gem 'zeroclipboard-rails', '~> 0.1.0' , is that a problem?
[16:51:18] FrostCandy: fryguy: so minor versions match? ok. If I got to my production server, where would you go to get a gem list ? Do I just have to figure out where ruby is installed on the amazon webserver then run the command GEM LIST there? - also thanks dmi i'll read it now.
[16:54:09] FrostCandy: fryguy: ah ok ~> greater than or equal to
[16:55:13] FrostCandy: well major version
[16:55:18] FrostCandy: 2 - 2.9999999
[16:56:10] FrostCandy: 2.0.1 - 2.0.9999 actually lol
[16:56:27] FrostCandy: still have a problem though - maybe after i finish reading your doc i'll figure it out.
[16:58:35] FrostCandy: fryguy: to answer your question - dosen't work means on my test server i can click a button that autoamtically copy's the text of a textara box - but on my production server nothing happens when i click the ZeronClip button
[16:58:55] FrostCandy: made me think there was a gem discrepency
[17:00:47] FrostCandy: oh yup i see it now misread their exmaple
[17:08:24] FrostCandy: ok the zeroclipboard-rails (0.1.2) is on my prod server too, must be something else causeint it to work on test server but not on prodution
[17:42:29] FrostCandy: So - one site was blocking flash , the other was not :) Derp.
[17:42:49] FrostCandy: Chrome wasn't reporting that it was blocking the flash plugin though which was wierd so it took me a while to figure it out .

2018-03-19

[20:55:14] FrostCandy: has joined #RubyOnRails
[20:55:14] FrostCandy: has joined #ruby
[20:55:54] FrostCandy: Anyone know how to add a parameter to the will_pagnate link? will_pagnate is a gem and I want to add a parameter like search
[21:20:12] FrostCandy: nm it's automaticaly figured out heh

2018-03-13

[21:20:05] FrostCandy: has joined #RubyOnRails
[21:20:05] FrostCandy: has joined #ruby
[21:21:12] FrostCandy: I'm not sure this could ever happen, but if someone were to call one of my webpages I can read the url they used with request.original_url, but how do i read the headers if any?

2018-03-06

2018-03-05

[22:45:13] FrostCandy: has joined #RubyOnRails
[22:45:13] FrostCandy: has joined #ruby
[22:46:11] FrostCandy: I have a line like redirect_to camp_act_path(@camp), so is camp the controller and act the method? or vice versa? or something different completely ?

2018-02-28

[21:32:26] FrostCandy: has joined #RubyOnRails
[21:32:26] FrostCandy: has joined #ruby
[21:33:33] FrostCandy: Is this now how you use strip? row["fluffybunny"].strip It gives me a noMethodError but the ruby docs sho " hello ".strip #=> "hello"
[21:37:18] FrostCandy: oh ok dminuoso thanks i'll look
[21:37:28] FrostCandy: so you are right it was nil :D
[21:37:50] FrostCandy: easy mistake, sorry to bother
[22:15:44] FrostCandy: has joined #RubyOnRails
[22:15:44] FrostCandy: has joined #ruby
[22:17:33] FrostCandy: Hi all, I'm wondering in my routes area I have a collection do get "public" end, it works fine for my url like /place/id/action/public but I want to have /place/id/action/public/random_number is there a way I can tell rails to ignore the last slash path part ?
[22:30:39] FrostCandy: Ah ha! in routes I just need to add a symbol for it it seems.

2018-02-27

2018-02-26

[20:27:14] FrostCandy: has joined #RubyOnRails
[20:27:14] FrostCandy: has joined #ruby
[20:29:55] FrostCandy: I have a link like this <%= link_to 'VIEW', about_user_path(@user)%> which creates a link like usuers/70/more_path/ How do I use link_to to add a ?timestamp=3848385884 at the end?
[20:30:06] FrostCandy: or is that not possible with link_to

2018-02-20

[14:15:19] FrostCandy: has joined #RubyOnRails
[14:15:19] FrostCandy: has joined #ruby
[14:15:49] FrostCandy: I'm trying to create a hash with an array of hash's (objects) in it - https://gist.github.com/anonymous/c895d328d1d8684c37308d7f5ae8353f
[14:16:22] FrostCandy: Is that the right way to write it?
[14:20:35] FrostCandy: ya it seems to work but i'm trying to send it in an http::post which I guess can't seem to send the data field as an array
[14:20:58] FrostCandy: request.set_form_data(d) fails i think
[14:21:03] FrostCandy: i'l have to look into it
[14:28:13] FrostCandy: tobiasvl: Ah set_form_data doen't handle nested hashes.

2018-02-07

[22:45:41] FrostCandy: has joined #ruby
[22:45:42] FrostCandy: has joined #RubyOnRails

2018-01-23

2018-01-22

[16:49:29] FrostCandy: has joined #RubyOnRails
[16:49:29] FrostCandy: has joined #ruby
[16:50:12] FrostCandy: Confusing. Does .nil? catch mysql NULL, ruby nil, and mysql '' as true?
[16:53:12] FrostCandy: Prgramming is hard, when I grow up I want to be a non-essential governmental worker. :)
[16:54:15] FrostCandy: apeiros: would a empty string be nil too?
[16:55:07] FrostCandy: it shouldn't, so to check for nil or empty do i need to check 2 things or is there a idomatic way of checking this in ruby
[16:55:56] FrostCandy: Ah ok, so testing is the best thing to do here as it could be diff dependign on dirvers
[16:56:14] FrostCandy: ok thanks apeiros
[23:18:35] FrostCandy: can I put a condition inside of a hash? h = { h1: => @derp['path1']['path2'] unless @derp['path1']['path2'].nil? }
[23:19:41] FrostCandy: or maybe a h = { h1: => '' || @derp['path'], }
[23:24:16] FrostCandy: havenwood: didn't work I think i'll have to do something like h[:1] = this || that if nil instead of putting the conditiotns inside the hash

2018-01-18

[14:00:45] FrostCandy: has joined #RubyOnRails
[14:00:45] FrostCandy: has joined #ruby

2018-01-17

[19:30:51] FrostCandy: has joined #RubyOnRails
[19:30:51] FrostCandy: has joined #ruby
[19:35:11] FrostCandy: So here is a question may not be related to Rails. I added some third party CSS and it works fine on my computer and on every computer in my netowrk. When my boss goes to the site he doesn't get the css downloaded from the same webhead. Any ideas on that? He says he reset his cache.
[19:38:40] FrostCandy: there wouldnt be a user specific session that controls which css page to load right?
[21:58:37] FrostCandy: fryguy: Hey - that css issue was because the developers made 2 duplicate pages - one pages gets rendered when you click one link, another page renders when you click the other link lol. So like a sane person I included the css on one page not thinking there were duplicates.

2018-01-12

[19:37:19] FrostCandy: has joined #RubyOnRails
[19:37:19] FrostCandy: has joined #ruby

2018-01-11

[16:41:22] FrostCandy: has joined #RubyOnRails
[16:41:22] FrostCandy: has joined #ruby
[16:43:38] FrostCandy: Hi all, I want to set up a hash that will sometimes not include some variables for sending an http post. So basically d={ var1 = var2 unless var2.nil? } exept this will still have the key var1, and I don't want var1 at all if var2 is nil
[16:44:59] FrostCandy: maybe something like d = { (unless var2.nil? var1 = var2), (unless var4.nil? var3 = var 4) }
[16:55:13] FrostCandy: rather d = { (unless var2.nil? var1 => var2 ), }
[17:04:04] FrostCandy: found it, d[:v] = "there" unless x.empty?

2017-12-21

[17:59:21] FrostCandy: has joined #RubyOnRails
[17:59:21] FrostCandy: has joined #ruby
[18:02:43] FrostCandy: c = Client.find_by_sql("SELECT t1.id, t2.name as tname FROM t1 INNER JOIN t2 ON t1.id = t2.id") -- Assume Client is one of my db table classes, c doesn't let me read tname or data from table 2
[18:05:18] FrostCandy: ahhh Client.connection.select_all is what i needed.

2017-12-19

[16:56:54] FrostCandy: has joined #RubyOnRails
[16:56:54] FrostCandy: has joined #ruby
[16:59:47] FrostCandy: I have a line like User.find_by_email(email), where does ruby look to figure out where to find the User model? Do I need to require or include any files to make it look for User?
[17:59:04] FrostCandy: dminuoso: oh ok thanks

2017-12-18

[17:46:54] FrostCandy: has joined #RubyOnRails
[17:46:54] FrostCandy: has joined #ruby

2017-12-15

[17:33:26] FrostCandy: has joined #RubyOnRails
[17:33:26] FrostCandy: has joined #ruby
[17:35:33] FrostCandy: Why doesn't this work? A = {:type=>:account, :myarray=>[{"thing":"1", "thing2":"2" }] }
[17:35:51] FrostCandy: Shouldn't I be able to store json info in a hash like that?
[17:46:16] FrostCandy: well i kept getting errors saying unexpected, and : expected keyword end. But ya turning to to_json worked

2017-12-11

[16:30:47] FrostCandy: has joined #ruby

2017-11-22

[20:03:13] FrostCandy: has joined #RubyOnRails
[20:03:13] FrostCandy: has joined #ruby
[20:05:19] FrostCandy: if i do a <% render "_pagename" %> but it's in a diffenrt folder than where i'm calling it from, how to i tell render where to look? Right now i'm getting missing current_page/_pagename because it obvously can't find it.
[20:06:32] FrostCandy: oh looks like i just add the folder prefix myfolder/mypage

2017-11-15

[19:28:31] FrostCandy: has joined #ruby
[19:28:32] FrostCandy: has joined #RubyOnRails
[19:30:42] FrostCandy: Hi guys before i blow up my test database, is there any differnece between rake db:migrate and rails db:migrate? We use active record if that makes a differnce.
[19:55:33] FrostCandy: apparently there is a difference based on rails version. early versions need rake
[20:35:37] FrostCandy: tcopeland: yup thanks

2017-11-14

[18:59:18] FrostCandy: uh, in a xyz.each do block would you really want to do end unless xyz.blank? at the end? - if xyz is blank then it wouldn't enter the .each anyway right?
[18:59:47] FrostCandy: I can't imagine why the coder wrote it this way, does it serve any useful purpose?