espressocannon

Activity Graph

Page 1 of 2 | Next »

2018-03-19

[01:29:40] espressocannon: has joined #RubyOnRails
[01:30:20] espressocannon: can you use instance variables in loops?....
[01:30:21] espressocannon: https://gist.github.com/ELI7VH/35cc2e8e9ba93ef8df8701666035d86c
[01:31:32] espressocannon: I'm getting the strangest bug. I get a "SystemStackError (stack level too deep)" error when using instance variables for "response" I would like to use @response, to have an initialized response for my front-end, but I Get a stack error, meaning I have to write the same thing at the start of every action.
[01:32:52] espressocannon: when I remove the @ from in front of "response" (as seen in my gist) it works fine...
[01:54:19] espressocannon: is @response reserved somehow
[02:00:52] espressocannon: i don't get how.. the only difference is that I used @response instead of response
[02:01:15] espressocannon: when I change it back - and that's all I do, it works perfectly
[02:02:39] espressocannon: lol.. fakkkkkkkkk
[02:02:57] espressocannon: nvm. I just said render json: response... and not render json: @response
[02:36:37] espressocannon: what should I call it?
[02:36:45] espressocannon: I always have trouble coming upwith good names
[03:01:17] espressocannon: ill remember this when my wife is doped up during birth
[03:02:28] espressocannon: also my sensei would slap my wrists if I named my response variable a pirate name
[03:05:16] espressocannon: it's highly debated
[03:08:08] espressocannon: like. actual thanks for this list
[03:08:16] espressocannon: me and my wife are legit considering some of these
[03:20:35] espressocannon: Quit: Page closed

2018-03-17

[02:49:39] espressocannon: has joined #RubyOnRails
[02:51:29] espressocannon: hey guys. for some reason my association is giving me the wrong input
[02:51:30] espressocannon: https://gist.github.com/ELI7VH/957bb3bdb12aa919c0cb04a075527ee7
[03:09:23] espressocannon: in this lynda series I'm watching, it works for him somehow
[03:09:37] espressocannon: maybe it's because he is using SQL and I am using SQLite
[03:15:42] espressocannon: Quit: Page closed

2018-03-15

[20:55:50] espressocannon: has joined #RubyOnRails
[20:55:59] espressocannon: anybody having issues connecting to rubygems?
[20:56:03] espressocannon: my bundle install is hanging
[20:56:39] espressocannon: Fetching selenium-webdriver 3.11.0 Retrying download gem from https://rubygems.org/ due to error (2/4): Gem::RemoteFetcher::UnknownHostError timed out (https://rubygems.org/gems/selenium-webdriver-3.11.0.gem)
[21:05:03] espressocannon: anyways ill just use an old project for now
[23:35:01] espressocannon: Quit: Page closed

2018-03-11

[16:54:07] espressocannon: has joined #ruby
[16:54:53] espressocannon: can somebody help me figure out why this is looping infinitely?
[16:54:54] espressocannon: https://gist.github.com/ELI7VH/4fe4e0673700c2fa293301baf9e90b32
[16:55:49] espressocannon: my `return` statement doesn't seem to be exiting the function
[16:59:01] espressocannon: shouldn't the if statement at the top level of the function break it out? or does it only break the current "layer"
[17:02:31] espressocannon: only if the number is divisible by the key
[17:04:02] espressocannon: why would it be called if the condition is not met, though
[17:04:23] espressocannon: if (number / k) >= 1 should make it attempt the next key..
[17:05:48] espressocannon: but it shouldn't be recursing if that condition is not met
[17:06:00] espressocannon: it should ust be trying all the kv pairs
[17:06:12] espressocannon: then when it finds one, it recurses
[17:06:33] espressocannon: it shouldn't be. it should only decrement when the condition is met
[17:07:19] espressocannon: does it go loop until > condition > recurse > loop until > condition > recurse > return
[17:07:52] espressocannon: no problem i appreciate the help
[17:08:10] espressocannon: for the record. I do get theright result. but then it just keeps going
[17:09:01] espressocannon: https://gist.github.com/ELI7VH/9f07b9056381826a917fd56c84a54d48
[17:10:11] espressocannon: yes. with the new_number, which is number-1000
[17:10:33] espressocannon: why does it keep going if the recursion is calld?
[17:11:03] espressocannon: so do i like... break after the function?
[17:11:15] espressocannon: recursion* is called
[17:14:09] espressocannon: i think iget it
[17:14:37] espressocannon: ok so... here is what i did
[17:14:43] espressocannon: return map_dat_roman(roman_mapping, new_number, result)
[17:15:07] espressocannon: so that exits the recursion with that function
[17:15:45] espressocannon: so a "return" only "reutrns' a single recursion
[17:16:17] espressocannon: ok but, would i have to make a list of all the numbers and then find them?
[17:16:32] espressocannon: i thought ruby had an implicit return
[17:16:57] espressocannon: but `map_dat_roman(roman_mapping, new_number, result)`
[17:17:06] espressocannon: should have acted as an implicit return right
[17:17:20] espressocannon: putting `return` in front of that fixed the issue
[17:18:07] espressocannon: because find stops once the condition is met
[17:19:11] espressocannon: im still getting used to all thedifferent methods in ruby. im about 2 weeks into learning rails, and I just started doing ruby quizzes yesterday to actually learn wtf is happening
[17:19:51] espressocannon: it still kind of puzzles me, but I think I get it, and a find would for sure make more .... efficient?
[17:23:39] espressocannon: thanks again. now go get some coffee, you savage.
[17:25:49] espressocannon: oh wow. find is so much nicer
[17:26:11] espressocannon: https://gist.github.com/ELI7VH/d09b6c1296329ddeb5ee8dbb7861ccd0
[17:31:33] espressocannon: yeah. I just wanted to make it so if people put a decimal, it would get rid of that
[17:31:39] espressocannon: https://gist.github.com/ELI7VH/ef0101aae31acbe92872e1c3accb598e
[17:31:50] espressocannon: can you give me your thoughts onthis? is it still readable?
[20:17:35] espressocannon: Ping timeout: 260 seconds

2018-03-07

[17:58:10] espressocannon: has joined #RubyOnRails
[18:00:09] espressocannon: any idea why this link: `<%= link_to 'Apply For Job', {controller: :position_applications, action: :apply_for_position, temp_id: @active_temp.id, position_id: position.id} %>` would give me this error? `Couldn't find PositionApplication with 'id'=apply_for_position`
[18:01:03] espressocannon: I have tried adding {id: 0} to the params to 'hack' it into submission
[18:20:08] espressocannon: ummmm. not really
[18:33:31] espressocannon: ok but, this kind of cross linking works with this other link " <%= link_to 'Select for Hire', {controller: :positions, action: :select_hire, temp_id: @temp.id, position_id: position.id} %>"
[18:40:30] espressocannon: yeah. i am creating a new PositionApplication entry with the fields 'position_id' and 'temp_id'
[18:40:44] espressocannon: also these two links somehow create different urls
[18:41:22] espressocannon: so the position_application url is: http://localhost:3000/position_applications/apply_for_position?position_id=9&temp_id=3
[18:41:47] espressocannon: and the admin genrated url is: http://localhost:3000/positions/select_hire?position_id=9&temp_id=3
[18:42:12] espressocannon: oh .. wait. no they're the same
[18:43:50] espressocannon: and my "apply_for_position" controller just defaults to "show" for some reason, without even using the "apply_for_position" function
[18:45:14] espressocannon: so it uses '/position_applications/show' instead of 'position_applications/apply_for_position' ....
[18:45:41] espressocannon: yep my route is correct get 'position_applications/apply_for_position'
[18:51:38] espressocannon: so the main difference is that the "apply for position" link is creating an entry, while the "select hire" is editing one.
[18:57:44] espressocannon: i was trying to post with a get request
[19:14:53] espressocannon: Quit: Page closed

2018-03-05

[18:03:49] espressocannon: has joined #RubyOnRails
[18:04:29] espressocannon: Hello, can somebody point me to a place where I can add a single parameter to a view
[18:05:20] espressocannon: right now I have a "/dashboard" controller, which has custom views for prototyping. so I have "/dashboard/event_host" that will be showing an overview of what an event host will see when they use my app
[18:05:57] espressocannon: however, when I put "dashboard/event_host/id" I get an error saying there is not route matching that, which I understand... What I don't understand is exactly how to add this specific route...
[18:06:21] espressocannon: right now when I submit my form it submits as "dashboard/event_host.id"
[18:07:49] espressocannon: http://edgeguides.rubyonrails.org/routing.html
[18:07:49] espressocannon: i can't find it on this page
[18:12:52] espressocannon: 70.65.116.186:3000/dashboard/event_host/1
[18:13:01] espressocannon: added this code to my routes.rb get 'dashboard/event_host/:id', to 'dashboard#event_host'
[18:14:09] espressocannon: fucking hell forgot a colon
[22:35:30] espressocannon: Ping timeout: 260 seconds

2018-02-23

[00:02:48] espressocannon: i did not try this. I should mention I am about 2ish days into rails, and pretty new to ruby.
[00:03:00] espressocannon: I just finished the getting started with rails guide
[00:05:09] espressocannon: so are you suggesting making a loop from @postings on my overview page?
[00:05:51] espressocannon: then doing a <render posting> <link_to '...more'> kind of thing?
[00:09:51] espressocannon: oops sorry my bad. I was unclear of the problem
[00:10:16] espressocannon: wait maybe not sorry give me a sec
[00:16:08] espressocannon: https://gist.github.com/ELI7VH/34956fd0d459eea98a09359071c50868
[00:16:44] espressocannon: i have included the index and _posting, also you can view the app if needed
[00:17:13] espressocannon: 209.89.72.56:3000/postings
[00:18:41] espressocannon: at the bottom of the _posting
[00:18:53] espressocannon: *if* the render function is iterating
[00:19:36] espressocannon: but how can you put that between the iterates?
[00:20:15] espressocannon: oh... so 'more" is actually the post itself with the comments
[00:20:25] espressocannon: so it would have to be on every iteration
[00:20:54] espressocannon: but I think it makes more sense to just make a _postings.html.erb for this
[00:21:19] espressocannon: its just that, that doesn't make sense becasue the template itself is a single item
[00:21:53] espressocannon: or should I just do a loop at this point, inside the "_postings" partial
[00:22:35] espressocannon: http://209.89.72.56:3000/postings/3
[00:22:56] espressocannon: it would show the full post with comments. in the future this will be the job with the applicants
[00:24:19] espressocannon: yeah so @mroutis. This is actually not the direction I was going. I'm actully trying to display comments on each post.
[00:24:31] espressocannon: "full details" if you will
[00:24:57] espressocannon: however I don't need that in the "show" template, because you don't need to show full details on the page that is already showing the details
[00:25:25] espressocannon: also yeah @darkstego, from my extremely limited knowledge of rails that sounds ike a trivial project.
[00:28:59] espressocannon: well I decided to just make a separate partial, with specific stuff. I am just trying to not DRY haha. I want to try and follow conventions as closely as possible.
[00:30:05] espressocannon: i appreciate the help. that @postings.first will come in handy!
[00:30:48] espressocannon: @darkstego - the worst that can happen is that you get it done faster than normal. I say go for it with rails.
[00:42:45] espressocannon: btw any atom users in here?
[00:55:05] espressocannon: Quit: Page closed
[01:15:32] espressocannon: has joined #RubyOnRails
[01:15:56] espressocannon: is there any way to generate a form based on all it's fields in template
[01:17:18] espressocannon: also, it just seems redundant to me that I have to "permit.()" fields, when my app knows all the fields that are in the database already.
[01:17:29] espressocannon: that i should permit*
[01:19:25] espressocannon: fair enough. In the docs it said to permit all the things in your table to prevent against malicious attack, I just think it should have a "permit all submissions from fields that exist in your tables" for certain things
[01:19:53] espressocannon: my plan is to not even render things if they aren't admin
[01:20:02] espressocannon: I do see what you're getting at though.
[01:25:01] espressocannon: ok so real life question, you're saying that for my "new user" form
[01:25:05] espressocannon: https://gist.github.com/ELI7VH/6566d7958c99c5b6ae0cae24b6b79f29
[01:25:47] espressocannon: I have to make a 'posting_params' method like this:
[01:26:26] espressocannon: params.require(:user).permit(:name,:phone_number,:city,:email,.......,........,.......,.......,.......,......,......,......,......,......)
[01:29:47] espressocannon: is there not a shortcut to that somehow? like instead of listing 25 fields, just do a "dont include these fields" in the .permit()
[01:31:33] espressocannon: for example. for my 'users' table, the listof "don't include" is ':activation_date' as well as the builtins like creation and modification dates.
[01:36:10] espressocannon: yeah, I'm not suggesting I know better, but during my learning curve I am going to be spending so much time going back and forth, also for things like creating large user profiles, where the view is /user/new - if somebody were to try and hack that, the worst they could do is make a user with all the fields that I want them to right? (if i were to exclude the builtin ones as well as the 1 or 2 ones for admin only)
[01:37:13] espressocannon: there is also the very real possibility that i am a huge noob and my tables shouldn't have this many fields. I am extremely new to databases.
[01:53:12] espressocannon: yeah I am working on doing that tbh. It just doesn't make sense that I would be writing 20-30 fields in the .permit() method, when it makes more sense to permit all from the list and then exclude the 3-4 that you don't want in there..
[01:54:22] espressocannon: this is just a little nitpick honestly. I'm just tryng to see the logic behind it, that convention over config (from the example they gave in the tutorial) alluded to writing 'less'
[01:54:46] espressocannon: do you have applications where you are permitting a ton of fields in that method?
[01:56:50] espressocannon: so you just put in a giant list of them? just like one after the other on that line?
[01:58:47] espressocannon: oh well that's at least more readable
[01:59:46] espressocannon: wasn't sure if that kind of thing was .... allowed.
[02:39:37] espressocannon: "proserve_expires"=>{"year"=>"2019", "month"=>"4", "day"=>"19"} - so this is the object that was tossed int my database
[02:40:01] espressocannon: i am trying to access it in my template by using @user.proserve_expires but it returns nothing
[02:40:25] espressocannon: I have tried @user.proserve_expires.year and also ['year']
[02:41:45] espressocannon: my table field is "t.date"
[02:42:20] espressocannon: and I used "<%= select_date %> to get it
[17:22:13] espressocannon: what is the link_to for the root direcotry
[17:23:27] espressocannon: I swear i googled it
[17:29:40] espressocannon: got a question about conventions: Where do you put your global partials. like top-level menus
[17:29:53] espressocannon: ie. things that are used on many different views
[17:32:36] espressocannon: alright I don't think I've gotten to that point yet.I shouldn't even be bothering with front end right now anyways, I still gotta somehow figure out how to database
[17:32:49] espressocannon: thanks for the tipthough, ill check out this layout stuff
[17:34:35] espressocannon: no I like the idea of layouts
[17:35:19] espressocannon: But I need to get my data sorted before I start messing with the front end. I am trying to figure out how to associate my various tables.
[17:35:50] espressocannon: it has application / mailer.html.erb in it
[17:42:56] espressocannon: well. I think I am just used to the concept of partials because I used to build sites from scratch with html/css and php includes
[17:43:46] espressocannon: I am about 2 years into actual programming (i didn't actually use php for anything more than includes) so I am into the idea of programatically building sites
[17:43:52] espressocannon: I ust need to learn how, know what I mean
[17:44:19] espressocannon: I am now 3 days into rails, so after I figure this database out, I will jump into layouts.
[17:44:36] espressocannon: though, in the end, I will most likely be using react for my front end
[17:44:44] espressocannon: I just feel more at home with JSX
[17:50:46] espressocannon: yeah. in the future that's my plan with rails
[17:50:55] espressocannon: for this particular project I will be using templates
[17:51:06] espressocannon: err. that is . rails for the full stack
[17:51:15] espressocannon: or at least back-end and front-end
[17:51:47] espressocannon: but yeah, in the future I will most likely be doing an API thing with rails. unless they are little quick projects for clients
[17:52:47] espressocannon: i gotta go do a bit of work, but thanks for the tips on layouts. I am going to give it a shot later today
[17:54:59] espressocannon: oiii. it's as easy as "render json:"
[19:20:41] espressocannon: Quit: Page closed

2018-02-22

[18:39:00] espressocannon: i was sent here from redit
[18:39:09] espressocannon: has left #ruby: ()
[18:41:33] espressocannon: has joined #ruby
[18:41:51] espressocannon: identify with services?
[18:42:32] espressocannon: thanks. it's been about 20 years since i last ircd
[18:45:38] espressocannon: past tense verb
[18:45:50] espressocannon: since I internet relay chatted*
[18:46:20] espressocannon: has joined #RubyOnRails
[18:46:26] espressocannon: thanks for helping a nub
[18:46:36] espressocannon: h. I am the newest to rails
[18:46:56] espressocannon: I got a question about a reference for database table ummm... column? types
[18:47:11] espressocannon: that is. I can't seem to find a reference
[18:55:08] espressocannon: am i crazy or is the only refrence from a prev version
[18:55:09] espressocannon: http://guides.rubyonrails.org/v3.2/migrations.html
[18:57:31] espressocannon: im sure it hasn't changed, but, I just spent like an hour carefully reading the current active record documentation searching for it. (im a slow reader so that doesn't help)
[18:58:49] espressocannon: built in sqlite
[18:58:54] espressocannon: i am also a database noob
[18:59:35] espressocannon: just in more of a reference material instaed of the guide
[19:00:05] espressocannon: so it's dependent on the database type is it
[19:20:43] espressocannon: Quit: Page closed
[23:49:45] espressocannon: has joined #ruby
[23:49:57] espressocannon: how do i reset my nickserv password
[23:50:04] espressocannon: already forgot it
[23:50:36] espressocannon: no option for resetting pass
[23:52:17] espressocannon: Quit: Page closed
[23:52:55] espressocannon: has joined #RubyOnRails
[23:53:13] espressocannon: is there a way to check in templates if
[23:54:43] espressocannon: if <%= render @posting %> is going to render a single item or iterate thru a list? Currently I wanted to have a partial that would render "show more" if {posting} was an iterate
[23:55:16] espressocannon: should have named it job_posting