« Back to channel list

#RubyOnRails - 23 June 2016

« Back 1 day Forward 1 day »
[00:00:01] Radar: JamesGames: !gist-usage
[00:00:02] helpa: JamesGames: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[00:00:03] Radar: Please read that.
[00:00:36] davidw: has joined #RubyOnRails
[00:02:06] fmcgeough: has joined #RubyOnRails
[00:02:20] arBmind1: has joined #RubyOnRails
[00:03:17] JamesGames: https://gist.github.com/anonymous/924ec5d205570f1949bd312b7306d36e
[00:03:33] Radar: JamesGames: I can't help you if you're not going to follow my instructions.
[00:03:54] JamesGames: I read it but I will read it again
[00:03:54] Radar: JamesGames: Please create a single Gist which contains the controller, helper and view.
[00:04:08] Radar: I don't want to be leaping through different gists and trying to tie them all together.
[00:05:09] lightt: has joined #RubyOnRails
[00:06:49] JamesGames: https://gist.github.com/anonymous/a9002604a2f9c56f4468333f313c8823
[00:07:08] frozenfoxx: has left #RubyOnRails: ()
[00:07:20] Radar: Thank you very much.
[00:07:38] Radar: So what seems to be the issue here?
[00:07:46] JamesGames: ok. Can u see if the problem is the instance variable
[00:07:54] Radar: which instance variable?
[00:08:09] Radar: Is there a stacktrace too?
[00:08:12] JamesGames: I want to change the @room variable to reflect the room the user is in
[00:08:29] JamesGames: so it has to be set at the start and then modified
[00:08:48] JamesGames: and the attributes will fill in the room details
[00:08:50] Radar: Sounds like you might want to set it in the session
[00:08:54] Radar: session[:room_id] = @room.id
[00:09:23] JamesGames: I have a room_name in the users db
[00:09:32] JamesGames: not sure what u mena
[00:09:56] pawnbox: has joined #RubyOnRails
[00:09:59] JakFrist: has joined #RubyOnRails
[00:10:10] Radar: I'd recommend reading a book on Rails.
[00:10:16] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[00:10:18] Radar: Read another one?
[00:10:38] greengriminal: has joined #RubyOnRails
[00:11:34] JamesGames: how would i set the id in the sessoin
[00:13:21] JamesGames: come on people, stroke your beards and think for me, an instance variable, how to use in view, or what else would work?
[00:13:38] mutantspew: has joined #RubyOnRails
[00:14:59] macsteps: has joined #RubyOnRails
[00:15:20] jhass: I have no beard so apparently I can't help
[00:15:43] JamesGames: jhass: u know about the view?
[00:15:53] JamesGames: i ca nresend my gist
[00:16:11] jhass: no need to
[00:16:30] jhass: you could summarize your issue
[00:17:10] JamesGames: I am, maybe foolishly, using an instance variable in my view, @rooms, and i want to change it with a link
[00:17:26] JamesGames: It sounds trivial
[00:17:55] jhass: change it how?
[00:18:08] JamesGames: change it to the next room in the db
[00:18:33] jhass: I see you just @room = Room.find_by(name: params[:name])
[00:18:46] JamesGames: i know! right!
[00:18:48] jhass: so just link to that page with right name set
[00:19:03] JamesGames: now, there you have lost me
[00:19:17] JamesGames: it's all happening on show.html.erb
[00:19:28] JamesGames: no page changing
[00:19:31] jhass: just navigation_helper(determine_next_room_name)
[00:20:13] JamesGames: maybe, but I have to set the room at the top of the page, or somewhere before i change it
[00:20:39] emachnic: has joined #RubyOnRails
[00:21:08] jhass: if the user clicks on the link it's an all new request/response
[00:21:29] JamesGames: can u show me in code
[00:21:36] jhass: show what?
[00:22:24] JamesGames: i did link_to My_helper_method(name), to change the name, but when the page reloads I am getting the value reset
[00:22:37] helpa: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[00:23:13] JamesGames: ok the actual line: <%= navigation_helper("The Marsh") %>
[00:23:31] JamesGames: and that calls the helper with the new room name
[00:23:48] voidDotClass: Is it possible to delete the migration history for a project and start over?
[00:23:54] JamesGames: so why doesn't my view work?
[00:23:58] jhass: and generates you a link with the title "Back out" to that room
[00:24:13] jhass: you didn't really describe what doesn't work
[00:24:28] jhass: that is what you expect exactly and what happens exactly instead
[00:24:52] jhass: voidDotClass: while keeping the current schema?
[00:24:58] JamesGames: ok. I expect the room variable to change and all its attributes to follow suit
[00:25:06] voidDotClass: jhass no i manually deleted all my current tables
[00:25:09] voidDotClass: want to start over
[00:25:17] JamesGames: and it throws error after error
[00:25:20] havenwood: voidDotClass: If you don't need to keep the data in the db you can drop the db, delete the db/migrate/* migrations and do new migrations from scratch.
[00:25:36] jhass: JamesGames: you didn't show any error
[00:25:45] voidDotClass: havenwood, will that also make it stop telling me i haven't run migrations?
[00:25:50] jhass: JamesGames: if you need help in understanding an error, show it
[00:25:55] voidDotClass: there are some migrations i've made but not run, its messy
[00:25:56] havenwood: voidDotClass: Running the migrations will do that!
[00:25:57] jhass: and the code that produces it
[00:26:02] JamesGames: undefined method `name' for nil:NilClass
[00:26:02] voidDotClass: havenwood, i don't want to
[00:26:07] pawnbox: has joined #RubyOnRails
[00:26:08] voidDotClass: i have pending migrations i don't want to run
[00:26:13] voidDotClass: i want to start over
[00:26:14] jhass: so delete them?
[00:26:30] voidDotClass: jhass, just deleting db/migration/* will fix it?
[00:26:31] JamesGames: produced by : <%= @room.name.upcase %>
[00:26:36] jhass: voidDotClass: as havenwood said
[00:27:16] JamesGames: the instance variable must be initialized right?
[00:27:21] jhass: JamesGames: well I guess it's because your show action in your controller renders your show view too but it doesn't set @room
[00:27:47] havenwood: JamesGames: What method in the controller renders the view you're showing us? Do you define the instance variable you want to use in your view in that method?
[00:27:58] jmignault: has joined #RubyOnRails
[00:28:03] jhass: JamesGames: run rake routes to see what path helpers map to which paths and what paths map to which controller methods
[00:29:31] JamesGames: https://gist.github.com/anonymous/9b4341f5dae49ea71df470664bcd36bc
[00:29:40] JamesGames: did i do that right?
[00:30:21] JamesGames: havenwood: I honestly don't know
[00:30:26] jhass: what's "that" now specifically?
[00:30:42] JamesGames: the gist thing
[00:31:33] JamesGames: so it seems it wasn't just a poor instance variable
[00:31:53] jhass: you need to pay attention to what the URL is in your browser
[00:32:11] jhass: match that to the rake routes output so you know which controller action is used
[00:33:43] JamesGames: so. which route am i looking for?
[00:34:07] jhass: how should I know? I don't see your browser window. Nor want to
[00:34:22] JamesGames: Im guessing its a post, posting the output?
[00:34:32] jhass: that sentence makes no sense
[00:35:32] Radar: JamesGames: Which Rails book did you read?
[00:35:47] JamesGames: Ok. I don't know about the routes. I just imagined I could change a value by code.
[00:36:02] JamesGames: I read Micheal Hartle's book
[00:36:11] Radar: JamesGames: It seems like this current project is a tad too ambitious for your current skills. I would recommend trying something simpler.
[00:36:23] JamesGames: far too late for that
[00:36:46] JamesGames: jhass: what route would you use?
[00:36:49] jhass: how should I know? I don't see your browser window. Nor want to
[00:37:43] JamesGames: how would I go about linking a route to a view i have already made?
[00:37:57] jhass: a route doesn't link to a view
[00:38:03] jhass: it links to a controller action
[00:38:07] jhass: which renders a view
[00:38:13] Radar: I thought hartl's book taught that
[00:38:14] Radar: I guess not
[00:38:46] JamesGames: ok, I have a controller, and I need it to show the @room and @user variables
[00:39:00] jhass: a controller doesn't show variables
[00:39:03] Radar: [10:36:11] <Radar> JamesGames: It seems like this current project is a tad too ambitious for your current skills. I would recommend trying something simpler.
[00:39:09] jhass: it sets them so they can be used in a view
[00:39:22] dcunit3d: has joined #RubyOnRails
[00:39:36] cachemonay: has joined #RubyOnRails
[00:39:52] JamesGames: can I get my current controller to set @room and @user
[00:40:06] cachemonay: has left #RubyOnRails: ()
[00:40:14] JamesGames: or do i need a new one
[00:40:28] jhass: it does already. The navigation action sets @room
[00:40:33] jhass: the index action sets none
[00:40:39] jhass: the show action sets @user
[00:40:44] jhass: the new action sets @user
[00:40:51] jhass: the create action sets @user
[00:41:00] jhass: the update action sets @user
[00:41:09] jetpackjoe: has joined #RubyOnRails
[00:41:19] jhass: none sets @user and @room at the same time, but nothing is stopping you from changing that
[00:41:44] JamesGames: Brilliant! how?
[00:41:53] jhass: through assignment
[00:42:00] Radar: JamesGames: @room = Room.find(id)
[00:42:12] Radar: JamesGames: (covered in one of the free chapters, (Chapter 3) of Rails 4 in Action
[00:42:24] JamesGames: thank you radar,
[00:42:36] jenrzzz: has joined #RubyOnRails
[00:42:53] GodFather: has joined #RubyOnRails
[00:43:02] JamesGames: jhass: I should modify navigatioin?
[00:43:14] Radar: JamesGames: !try
[00:43:14] helpa: JamesGames: Why don't you try it and find out for yourself?
[00:43:47] JamesGames: I woulden't be here if I haden't spent 10hrs on it.
[00:43:54] jhass: it's nothing
[00:44:04] jhass: me neither
[00:44:12] Radar: JamesGames: We have no idea how your app works. You are the only one with any clue.
[00:44:13] jhass: you don't learn programming in 10 hours
[00:44:18] Radar: There's something about users and rooms
[00:44:26] Radar: but I'll be buggered if I know how they connect
[00:45:14] lightt: has joined #RubyOnRails
[00:45:32] JamesGames: jhass - assignment in controllers, I call them from hleper methods
[00:45:51] jhass: I'm not sure what that sentence is intended to tell or ask me
[00:45:57] macsteps: has joined #RubyOnRails
[00:46:01] JamesGames: the app updates user and room, thats all it does
[00:46:16] JamesGames: it's a which way adventure
[00:46:19] jhass: "updates" is a very generic, vague and undefined term
[00:46:33] helpa: http://i.imgur.com/tyViD.gif
[00:46:35] Radar: Going back to real work
[00:47:03] JamesGames: ok, it changes, the active record values for rooms and users
[00:47:27] jhass: I see no evidence of that in the code you've shown, but okay
[00:48:05] JamesGames: I want to be able to select a room by name or id, and change the values of user by direct assignment
[00:48:27] jhass: great, go ahead
[00:49:03] pdm_: has joined #RubyOnRails
[00:49:32] JamesGames: ok. Maybe we try something different. what would I change about my controller to get it to alter the room variable. Other than what it does?
[00:50:03] Radar: room = Room.find(a_different_id)
[00:50:05] desnudopenguino: has joined #RubyOnRails
[00:50:10] Radar: Sorry, @room
[00:50:17] jhass: for one definition of alter
[00:50:34] jhass: there are other definitions of alter that might need different code
[00:50:43] desnudopenguino: adam12: Thanks again for helping earlier, I am using byebug all over the place now
[00:51:06] jhass: (under the assumption you might mean the object assigned to the variable rather than which object is assigned to the variable itself only)
[00:51:29] JamesGames: now I understand that, but the "render" bit
[00:52:12] jhass: the render method is explained in your book, in the recommended rails 4 in action book as well as in the official rails guides and rails API documentation
[00:52:21] JamesGames: @room = Room.find_by(name: params[:name])
[00:54:33] Oliphaunte: has joined #RubyOnRails
[00:55:59] adam12: desnudopenguino: cheers.
[00:56:19] diegoviola: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/views/layouts/application.html.erb#L74-L78
[00:56:35] Radar: diegoviola: yes that's the code I linked you to.
[00:56:50] diegoviola: yeah it's not working for me, there is no 'alert alert-notice'
[00:56:57] creature: has joined #RubyOnRails
[00:56:57] creature: has joined #RubyOnRails
[00:57:27] Radar: Where would one be defined if there was one?
[00:57:33] Radar: Perhaps in the application stylesheet?
[00:57:42] JamesGames: jhass: Ok. Where does the render come in
[00:57:48] Radar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/assets/stylesheets/application.css.scss#L58-L65
[00:58:15] jhass: JamesGames: In the controller action in case you want to change Rails default action for it
[00:58:28] adam12: desnudopenguino: I prefer to use https://github.com/rweng/pry-rails and then instead of `byebug` you use `binding.pry`. No need for eval, etc. It's a Repl similar to IRB.
[00:58:39] diegoviola: Radar: I see, makes sense now :D
[00:58:40] JamesGames: jhass: u lost me?
[00:58:53] jhass: JamesGames: no I can still see you
[00:59:04] JamesGames: i meant the idea
[00:59:11] jhass: which idea?
[00:59:34] JamesGames: what the contoller default action?
[00:59:48] FaresKAlaboud: has joined #RubyOnRails
[01:00:26] jhass: the default behavior of a controller action when there's no explicit call to render is explained in your book, in the recommended rails 4 in action book as well as in the official rails guides and rails API documentation
[01:01:23] alexandernst: has joined #RubyOnRails
[01:02:27] JamesGames: OK. Im going to spend another night on this. What should I be reading up about?
[01:02:31] CustosLimen: has joined #RubyOnRails
[01:03:17] jhass: The basics of Programming, Ruby and the Ruby on Rails webframework for Ruby.
[01:03:57] eserror: has joined #RubyOnRails
[01:04:08] JamesGames: o god. I will be back here in a bit. Thanks jhass.
[01:06:29] valagalen: has joined #RubyOnRails
[01:09:39] greengriminal: has joined #RubyOnRails
[01:10:44] eljimmy: has joined #RubyOnRails
[01:11:14] eljimador: has joined #RubyOnRails
[01:11:38] xall: has joined #RubyOnRails
[01:11:54] Spami: has joined #RubyOnRails
[01:12:45] triptec: has joined #RubyOnRails
[01:28:55] jmignault: has joined #RubyOnRails
[01:29:12] Ropeney: has joined #RubyOnRails
[01:30:45] asheinfeld: has joined #RubyOnRails
[01:36:08] rodfersou: has joined #RubyOnRails
[01:36:22] roamingdog: has joined #RubyOnRails
[01:40:02] dave_352: has joined #RubyOnRails
[01:40:07] SteenJobs: aren’t all classes in directories under app/ autoloaded?
[01:40:32] dave_352: Depends on your config file.
[01:41:19] SteenJobs: i must be missing something then ha
[01:41:20] dave_352: search for config.autoload_paths
[01:41:41] dave_352: I've got something like this
[01:41:42] dave_352: config.autoload_paths += Dir[Rails.root.join('app', 'models', 'payments')]
[01:42:01] dave_352: cause I wanted to group a pile of payment models in a folder.
[01:42:24] SteenJobs: yea but i thought by default all directories under app/ are autoloaded
[01:42:28] SteenJobs: without needing to alter config
[01:42:42] tego101: has joined #RubyOnRails
[01:42:46] dave_352: I don't believe that's true.. it's a flatter system.
[01:42:47] safetypin: has joined #RubyOnRails
[01:43:11] sevenseacat: has joined #RubyOnRails
[01:43:11] dave_352: Were it true I'd not have those lines in my code :)
[01:43:27] SteenJobs: although is ‘payments’ a directory?
[01:43:56] dave_352: yeah.. app/models/payments/credit_card_payemnt.rb
[01:43:59] dave_352: and the likes.
[01:44:13] SteenJobs: right. if it was app/models/credit_card_payment.rb i think it’s supposed to autoload
[01:44:36] dave_352: Yeah that would
[01:44:47] SteenJobs: right, so i have app/services
[01:44:51] SteenJobs: and it ain’t workinnnnn
[01:45:12] SteenJobs: i’m getting “uninitialized constant ActionView::CompiledTemplates::StripeManaged”
[01:45:51] sevenseacat: did you restart your server/spring after creating app/services ?
[01:48:32] SteenJobs: "/Users/ME/Desktop/workspace/Rails/MyApp/app/services" is in the list for ActiveSupport::Dependencies.autoload_paths
[01:48:39] SteenJobs: restarted my server, yea
[01:48:59] sevenseacat: okay, so I jumped into this convo late - what class is not being autoloaded and what file is it located in?
[01:49:33] SteenJobs: hey - stupid miss on my part, but the constant is definitely availalbe in my controllers
[01:49:37] SteenJobs: it’s just in my view template
[01:49:45] SteenJobs: it’s a class in app/services
[01:50:06] SteenJobs: want to reference a constant from that class in my view - StripeManaged::Allowed
[01:50:12] centrx: has joined #RubyOnRails
[01:50:46] sevenseacat: cool. can you answer the questions now? :)
[01:51:14] SteenJobs: haha keeping me in check from day 1
[01:51:33] Oliphaunte: has joined #RubyOnRails
[01:51:42] SteenJobs: file is app/services/stripe_managed_service.rb
[01:51:55] ur5us: has joined #RubyOnRails
[01:51:58] SteenJobs: and the class StripeManaged is defined in that file
[01:52:27] sevenseacat: right. the filename has to match the name of the class inside, for it to be autoloaded.
[01:52:38] sevenseacat: yours doesn't match
[01:52:49] SteenJobs: that was your hunch the second you saw there was a problem, wasn’t it
[01:52:59] SteenJobs: haha, well done
[01:53:08] sevenseacat: either that or not restarting the server.
[01:53:30] pawnbox: has joined #RubyOnRails
[01:53:52] SteenJobs: got a new error
[01:53:54] SteenJobs: so thanks, it worked :)
[01:54:58] SteenJobs: explaining the phenomenon of getting a new error to someone on the non-tech side is a tricky one
[01:54:59] dave_352: anyone know if you can output render json in the console?
[01:55:42] dave_352: I've a serializer failing on one user.. but I can't replicate it in my dev system.
[01:59:01] JamesGames: has joined #RubyOnRails
[02:00:14] JamesGames: Hello. I am looking to initiailise a variable with user sign-up on rails
[02:00:49] dave_352: we need more James.
[02:01:39] _Tariq: has joined #RubyOnRails
[02:01:50] JamesGames: hey dave. I am changing a variable in my code. (And it works) and I want to initialise it when the user is activated
[02:02:08] JamesGames: I want one varaible for each user
[02:02:47] JamesGames: https://gist.github.com/anonymous/9b4341f5dae49ea71df470664bcd36bc
[02:04:02] JamesGames: I can change the variable with controller. I can display the page. But I want the user to get one value, "The Forest " when they are activated
[02:07:24] whathappens: has joined #RubyOnRails
[02:07:45] dave_352: On their record?
[02:07:54] dave_352: I mean in the DB?
[02:09:02] asheinfeld: has joined #RubyOnRails
[02:09:47] yfeldblum: has joined #RubyOnRails
[02:10:05] macsteps: has joined #RubyOnRails
[02:10:11] JamesGames: yes on the db
[02:15:00] JamesGames: listen. I can change the variable with a link, but I dunno where to declare or set it
[02:17:41] JamesGames: https://gist.github.com/anonymous/7d2236aafbce24d7285a2259b7e5e5b3
[02:17:41] bklane: has joined #RubyOnRails
[02:18:04] adam12: JamesGames: Presuming room_name is a field on your User model
[02:18:10] adam12: JamesGames: call user.save after it.
[02:18:32] adam12: JamesGames: And move the redirect_to line below user.room_name and user.save
[02:18:42] JamesGames: hello again. it is . user.save. where?
[02:18:56] adam12: JamesGames: After user.room_name = "The Forest"
[02:19:34] User458764: has joined #RubyOnRails
[02:19:47] JamesGames: so now in the view the user.room_name is set?
[02:20:15] adam12: JamesGames: Are you using Devise?
[02:20:28] JamesGames: and will it exist between login sessions? No devise
[02:20:35] adam12: Actually, if you are on the users/show.html.erb, and you have looked up the user, yes.
[02:21:08] JamesGames: and once I change it, the page will refresh?
[02:21:15] adam12: Change what?
[02:21:22] adam12: The room name?
[02:21:29] JamesGames: the field, room_name
[02:21:31] lightt: has joined #RubyOnRails
[02:21:51] adam12: It would refresh automatically, tho your controller has a redirect_to which will cause the page to "refresh" to a new URL
[02:22:02] adam12: It wouldn't refresh automatically, rather.
[02:22:37] JamesGames: ok so how do I refresh
[02:22:54] adam12: What are you trying to achieve? in plain english, no code.
[02:23:09] adam12: I've only got little bits of the puzzle here. If i know what you want, we don't have to play the code back and forth game :)
[02:23:46] xall: has joined #RubyOnRails
[02:24:00] dnewkerk: has joined #RubyOnRails
[02:24:04] JamesGames: plain english- I want the user to be able to change rooms via a bunch of links, and take up/ use items in those rooms, it's a which - way adventure.
[02:24:27] adam12: In this instance, I would stick the current room in their session.
[02:24:42] adam12: but if you already have it stored in the model, that's fine too.
[02:24:48] adam12: You need an action that accepts the new room name
[02:24:51] adam12: and then does the redirect.
[02:25:03] JamesGames: I dunno if it is in the name
[02:25:17] adam12: OK - you need something that accepts the new Room
[02:25:27] adam12: Do you have a Room model? I believe so, yes?
[02:25:51] JamesGames: yeah, I have a db with rooms in it if that 's what u mean
[02:26:18] adam12: What happens when they enter a room? What is displayed?
[02:27:00] JamesGames: well, im not sure , show.html.erb will hopefully display room.description, room.text etc
[02:27:13] JamesGames: I know that bit off
[02:27:19] adam12: You can do that, but I suggest another controller
[02:27:24] adam12: with it's own view file.
[02:27:27] adam12: RoomsController
[02:27:30] adam12: with it's own show.html.erb
[02:27:49] adam12: In app/controllers, make a rooms_controller.rb file
[02:28:07] JamesGames: so I destroy the old one?
[02:28:15] adam12: You have one already?
[02:28:28] JamesGames: i meant the user one
[02:28:36] adam12: No - you can save that one. You'll have multiple.
[02:28:51] adam12: Multiple controllers, multiple views.
[02:29:12] JamesGames: ok so, I make a rooms_controller and a view
[02:29:25] JamesGames: and I mix the two views?
[02:29:31] adam12: You need a rooms_controller.rb in app/controllers, and a new folder in app/views called rooms
[02:29:48] jmignault: has joined #RubyOnRails
[02:30:16] adam12: Well, technically most of the stuff you had in users/show.html.erb likely didn't belong
[02:30:21] adam12: Since they were for a room, not a user.
[02:30:27] JamesGames: is there like a generate command for that? or
[02:30:40] adam12: rails g controller rooms show
[02:30:49] adam12: I don't use generators so .. I'm guessing?
[02:30:56] JamesGames: I was thinking, the user has a room variable for the room he is in
[02:31:08] adam12: JamesGames: Yeah - the connection is there but it's super loose.
[02:31:12] JamesGames: can we mix these views
[02:31:24] adam12: Well, I would copy out what you want from show.html.erb
[02:31:32] adam12: users/show.html.erb rather
[02:31:36] adam12: and put it in rooms/show.html.erb
[02:31:49] adam12: That said, if it's shared between both, it can go in layouts/application.html.erb
[02:32:16] JamesGames: will that work?
[02:32:17] northfurr: has joined #RubyOnRails
[02:32:36] JamesGames: that sounds clever
[02:32:49] adam12: Well, let's just start with not sharing. Stick it in rooms/show.html.erb
[02:33:11] adam12: Your controller has a sign_in method. Where'd that come from?
[02:33:36] JamesGames: I made it. Just went along with the M Hartl book
[02:34:12] JamesGames: i delete it?
[02:34:30] adam12: but if you want to know what room the user is in, you need to know what user is signed in.
[02:34:37] adam12: I wanted to know if you had got that far.
[02:35:08] Oliphaunte: has joined #RubyOnRails
[02:35:33] rueben: has joined #RubyOnRails
[02:36:11] JamesGames: ok there is no rooms view
[02:36:22] adam12: There should be a rooms/show.html.erb view
[02:36:25] adam12: if you ran that generator.
[02:36:44] dezull: has joined #RubyOnRails
[02:37:45] JamesGames: no generator. i put it in
[02:38:02] adam12: You made app/controllers/rooms_controller.rb
[02:38:28] JamesGames: yes. both blank
[02:38:43] adam12: Make app/views/rooms as a folder
[02:38:49] adam12: and app/views/rooms/show.html.erb as a file
[02:39:25] adam12: Copy over what you want to display on the room page from the users/show.html.erb to rooms/show.html.erb
[02:39:40] JamesGames: ok. gimme a minute
[02:40:59] JamesGames: i can do it later. is just @room.attribute anyway, EZ, even 4 me
[02:41:50] JamesGames: u there adam?
[02:41:56] adam12: JamesGames: Just typing something out
[02:44:01] adam12: JamesGames: Your rooms_controller file: https://gist.github.com/adam12/23550a91e9bb3fb6f6a2cd86c7ef9cf8
[02:44:16] adam12: JamesGames: Those 2 comments in there are routes - you want to add them to your routes.rb file.
[02:44:20] JamesGames: are u serious?
[02:44:40] sevenseacat: JamesGames: what tutorials have you followed for Rails so far?
[02:46:00] JamesGames: thanx adam!!!
[02:46:25] JamesGames: sevenseacat: rails4zombies and M Hartl's bk
[02:46:53] peterppp: has joined #RubyOnRails
[02:47:24] JamesGames: How we gonna mesh the views?
[02:47:37] adam12: I don't get "mesh"?
[02:47:54] adam12: You have stuff in users/show.html.erb you want on the screen when they are viewing a room, ya?
[02:48:12] adam12: Copy/move to rooms/show.html.erb
[02:48:36] adam12: If they are shared, they can eventually go in layout, but let's not complicate it just yet.
[02:50:01] pawnbox: has joined #RubyOnRails
[02:50:08] adam12: Now, presuming you've added those routes, and you have a current_user object from one of the tutorials you followed, you should be able to go to /rooms/current
[02:50:08] JamesGames: done. messy. but I know how to fix it
[02:50:33] viiralvx: has joined #RubyOnRails
[02:50:59] DTZUBDUB: has joined #RubyOnRails
[02:51:11] JamesGames: jus login and try?
[02:51:29] adam12: It's assuming you have a room with a name that matches your DB.
[02:52:32] sevenseacat: I'm a little concerned that you didn't pick up much information from the tutorials
[02:53:10] JamesGames: no joy. "something went wrong"
[02:53:13] sevenseacat: like what a route is and where it goes, and what a model is
[02:53:34] adam12: JamesGames: could be anything. You'll need to create/update a gist with the full error.
[02:53:52] sevenseacat: "something went wrong" also isnt something you should see in development
[02:53:58] adam12: And we share gists by URL, not by ID.
[02:53:59] Oliphaunte: has joined #RubyOnRails
[02:55:29] xall: has joined #RubyOnRails
[02:55:41] JamesGames: where do I get the error readout?
[02:55:48] adam12: JamesGames: Are you running this on Heroku?
[02:56:12] JamesGames: no but I could if you like
[02:56:19] adam12: How are you running it right now?
[02:56:23] adam12: Are you on Mac? Linux?
[02:56:28] JamesGames: localhost on cloud 9
[02:56:39] quazimodo: has joined #RubyOnRails
[02:56:42] adam12: On Cloud9, do you run `rails server` anywhere?
[02:56:43] JamesGames: windows. I was linux....
[02:56:51] adam12: in a tab at bottom or anything?
[02:57:12] DoctorMonocular: does email tracking vi invisible pixel still work? reliably?
[02:57:53] adam12: JamesGames: Need to find the rails server. It has to be running somewhere.
[02:58:07] JamesGames: but i run it with "Rails server -b $IP -p $PORT"
[02:58:20] JamesGames: u want my url?
[02:58:30] adam12: JamesGames: No - the output comes from running that command somewhere.
[02:58:41] JamesGames: https://mytestingspace-computron59.c9users.io/rooms/current
[02:59:33] JamesGames: its saying this is the error : @room = Room.find_by(name: current_user.room_name)
[03:00:09] JamesGames: did'ja check out my app?
[03:00:15] adam12: Requires login.
[03:00:23] adam12: Maybe current_user doesn't exist
[03:00:31] adam12: Change to `@room = Room.first`
[03:00:37] adam12: Just to keep moving.
[03:03:01] JamesGames: nearly have it
[03:03:40] JamesGames: yes - Rooms current shows the forest
[03:03:54] adam12: Right - but it's using the first room it found, not the current user's room
[03:03:55] JamesGames: !! amazing !!
[03:04:24] adam12: I was assuming current_user was a helper that fetched the user ID from session
[03:04:34] adam12: but I'll leave that to you to explore. I have to run.
[03:04:55] wmoxam: has joined #RubyOnRails
[03:05:16] JamesGames: wait, current user from last session? how would I attempt that?
[03:06:03] adam12: JamesGames: I'm sure there is a tutorial out there
[03:06:04] pawnbox: has joined #RubyOnRails
[03:06:06] JamesGames: ok. Thanks for everything Adam..
[03:06:11] adam12: but basically, when you sign in the user, you stick their ID in the session
[03:06:13] Radar: JamesGames: !r4ia
[03:06:13] helpa: JamesGames: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[03:06:32] Radar: JamesGames: Please, for the love of all that is precious, please read a Rails book and go through at least the first 6 chapters.
[03:06:36] adam12: and fetch it out at every page load. Way beyond the scope of what I can walk you through. And I gotta jet.
[03:06:46] northfurr: has joined #RubyOnRails
[03:06:48] adam12: And I agree - work through the book / tutorial, start to finish.
[03:06:53] jm3: has joined #RubyOnRails
[03:07:13] Radar: Just the first 6 chapters of Rails 4 in Action will be enough for you to get the answers to all the questions you've been asking over the past 3 hours.
[03:07:19] adam12: I worked through this with you because I had some time - but a lot of this is self explanatory if you read *in thorough* the books / tutorials.
[03:07:27] JamesGames: thanks u guys!!!!
[03:07:50] adam12: Cool. Cheers.
[03:08:15] triptec: has joined #RubyOnRails
[03:08:18] one_zero: has joined #RubyOnRails
[03:10:44] roamingdog: has joined #RubyOnRails
[03:11:43] DTZUBDUB: has joined #RubyOnRails
[03:18:32] braincrash: has joined #RubyOnRails
[03:21:25] k3rn31: has joined #RubyOnRails
[03:21:30] SteenJobs: can a JSON response by accessed with dot syntax?
[03:21:43] SteenJobs: i thought it could, and the sample code i’m looking at does, but i’m pretty sure it isn’t working
[03:22:25] adam12: Not by default.
[03:23:24] SteenJobs: in that case i wonder why the sample code uses it that way
[03:23:24] adam12: I think there are libraries that might convert it for you. Hashie/Mashie maybe? I'd avoid.
[03:25:26] dcunit3d: has joined #RubyOnRails
[03:29:32] qbar: has joined #RubyOnRails
[03:30:41] qbar: I have been struggling trying to find out a way to grant specific people access to specific records. It seems the entire web point to cancan and pundit.
[03:31:02] Lytol: has joined #RubyOnRails
[03:31:07] qbar: Those seem to generic for granting item level permissions like that
[03:31:59] jmignault: has joined #RubyOnRails
[03:31:59] sevenseacat: that is indeed the entire point of authorization libraries
[03:32:20] ElFerna: has joined #RubyOnRails
[03:32:21] qbar: I don't have just Admin, Member, and Viewer roles across the board. Take a photo gallery. Person 1 should be able to see galleries A, B, and C, but not D, E, or F.
[03:32:52] qbar: I can't just check if they are viewer. They need per-gallery roles.
[03:33:25] sevenseacat: thats fine. so instead of linking roles to galleries in an access table, you link users to galleries
[03:33:52] sevenseacat: which is what we do in R4IA
[03:35:11] qbar: users and galleries; many-to-many? Using something like has many through role_assignments?
[03:35:52] roamingdog: has joined #RubyOnRails
[03:37:03] sevenseacat: we have users and projects with each user having a specific role on a project, but yes
[03:37:23] qbar: That just maps the users to the galleries, right? I need something else to keep track of the role.
[03:37:38] qbar: I am struggling to understand what that something else should be.
[03:37:47] sevenseacat: no, we also give each user a specific role on a project.
[03:38:08] Radar: qbar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/role.rb
[03:38:20] Radar: qbar: We have a Role model which tracks what roles a user has on a particular project.
[03:38:25] crdpink: has joined #RubyOnRails
[03:38:30] Radar: qbar: You should do the same, except instead of projects it's galleries.
[03:38:52] Radar: To determine if a user can see a project, we use: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/policies/project_policy.rb#L11-L13
[03:39:08] Radar: has_member? is defined here: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/project.rb#L7-L9
[03:39:28] crdpink2: has joined #RubyOnRails
[03:39:39] sevenseacat: all neat and tidy
[03:39:57] qbar: How do you relate users to projects?
[03:40:08] sevenseacat: with that Role class
[03:40:11] qbar: user and projects both have many roles.
[03:40:47] sevenseacat: thats correct.
[03:40:57] qbar: I guess I am still trying to wrap my head around it
[03:41:54] pawnbox: has joined #RubyOnRails
[03:42:35] qbar: does that allow you to say @user.project.role ?
[03:42:43] sevenseacat: no, because a user has many projects
[03:43:17] qbar: @user.projects.find(:first).role
[03:43:28] qbar: or something similar?
[03:43:43] roamingdog: has joined #RubyOnRails
[03:43:59] sevenseacat: what exactly are you trying to achieve with that
[03:44:04] sevenseacat: because its going backwards
[03:44:18] sevenseacat: you access projects through the roles, not roles through the projects
[03:45:54] qbar: sorry. My brain is a little frazzled right now. Been working on this for a while. What is throwing me off is that you never say that user has_many projects
[03:46:06] User458764: has joined #RubyOnRails
[03:47:02] sevenseacat: qbar: but we very easily could, by adding has_many :projects, through: :roles in the user model. it doesn't make a lot of sense to do so though
[03:47:31] qbar: You have two 1 to many relationships, right?
[03:47:37] sevenseacat: because users have different permissions on all of those projects
[03:48:06] sevenseacat: the app has many relationships, you'll have to be more specific.
[03:48:19] qbar: Just talking about users, projects, and roles
[03:48:57] qbar: one user has many roles. and one project has many roles
[03:49:03] sevenseacat: the relationships are exactly what the code says they are
[03:49:32] sevenseacat: the book that goes with this code is a good read, for the record :)
[03:49:48] DZj091231kld: has joined #RubyOnRails
[03:50:05] elomatreb: has joined #RubyOnRails
[03:51:57] Radar: qbar: in the app we don't have a usecase for displaying all the projects that a user has access to.
[03:54:47] roamingdog: has joined #RubyOnRails
[03:54:53] peterppp: has joined #RubyOnRails
[03:55:15] qbar: That is exactly what I need. I feel like I am so close to having an ah-ha moment where I am going to feel dumb for not understanding this
[03:55:34] Radar: You need to show all the galleries for a user?
[03:56:09] qbar: all galleries that the user should be able to see
[03:56:29] chipotle: has joined #RubyOnRails
[03:56:30] qbar: If someone has granted that user access to a gallery for example
[03:56:50] Radar: qbar: Right, so you'd define has_many :roles on the user, then has_many :galleries, through: :roles
[03:57:06] Radar: If the user doesn't have a role for a gallery, then the gallery won't be returned in user.galleries
[03:57:45] chipotle: has joined #RubyOnRails
[03:58:04] qbar: I had throught I would need a many-to-many relationship between galleries and users with a join table called role_assignments
[03:58:36] qbar: which is what you just verified
[03:58:49] qbar: But how do I keep track of the different kinds of roles?
[03:58:54] qbar: that is what I am struggling with
[03:59:22] qbar: do I need a 3rd column in the role_assignments table or a 4th table
[03:59:42] Radar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/role.rb#L5-L7
[03:59:46] Radar: We hardcoded them in the model
[04:00:23] Radar: Then we have a drop down per project for what role the user has
[04:00:24] qbar: so, a 3rd column
[04:00:26] Radar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/role.rb#L5-L7
[04:00:40] Radar: Yes, the three columns are user_id, gallery_id and role.
[04:01:05] rubyonrailed: has joined #RubyOnRails
[04:01:27] qbar: what kind of relationship do you guys have? That is not a has_many through. I never would have throught to set it up like that.
[04:01:54] Radar: Which is not a has_many :through?
[04:02:09] Cache_Money: has joined #RubyOnRails
[04:02:43] qbar: users to projects to roles
[04:04:24] Radar: users to roles to projects
[04:04:31] Radar: roles is the intermediary table
[04:05:26] djbkd: has joined #RubyOnRails
[04:05:34] roamingdog: has joined #RubyOnRails
[04:06:15] Guest12: has joined #RubyOnRails
[04:06:51] Hyuk: has joined #RubyOnRails
[04:08:19] alfiemax: has joined #RubyOnRails
[04:09:22] Neo--: has joined #RubyOnRails
[04:11:29] qbar: What is the difference between how your app assiciates projects and users via the roles table VS projects and users has_many through roles
[04:11:30] haaj: has joined #RubyOnRails
[04:12:02] qbar: It seems like the roles table would have a project_id and user_id in each scenario.
[04:12:18] k3rn31: has joined #RubyOnRails
[04:13:55] speakingcode: has joined #RubyOnRails
[04:15:58] Radar: qbar: yes, it does have a project_id and a user_id.
[04:16:07] Radar: qbar: and I don't understand the question
[04:16:31] qbar: do both approaches accomplish the same thing.
[04:16:46] qbar: I'm trying to understand when to do what your app does VS when do to has many through
[04:16:56] Radar: I am very confused. It sounds like you're talking about the same approach twice.
[04:17:08] qbar: since the resulting tables would be the same, right?
[04:17:16] Radar: Can we stop for a sec?
[04:17:26] Radar: We have a model called Project
[04:17:26] Radar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/project.rb
[04:17:31] Radar: It has a has_many :roles association
[04:17:45] Radar: The roles association goes to the roles table, which has a Role model
[04:17:53] Radar: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/role.rb
[04:17:58] Radar: This Role model belongs to both user and project.
[04:18:04] Radar: The User model is defined as you think it would be.
[04:18:16] Radar: The Role model has 3 fields: project_id, user_id, and role.
[04:18:44] Radar: To determine if a user can access the project, we do `project.has_member?(user)`, using this method: https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/models/project.rb#L7-L9
[04:19:37] sandelius: has joined #RubyOnRails
[04:19:40] PotatoChipz: has joined #RubyOnRails
[04:19:45] Radar: qbar: is that clear?
[04:21:17] _Tariq: has joined #RubyOnRails
[04:22:52] roamingdog: has joined #RubyOnRails
[04:24:08] qbar: Could you accomplish the same thing by defining "user has many projects through roles" and "project has many users through roles" and then add a roles column to the roles table(that would initially only have a project_id and user_id fields)?
[04:27:52] Radar: qbar: yes
[04:28:46] qbar: Is there a primary difference between those two approaches?
[04:30:20] hahuang61: has joined #RubyOnRails
[04:31:11] FrankD__: has joined #RubyOnRails
[04:32:25] Radar: qbar: it's the same approach?
[04:32:30] Radar: qbar: what is different between the two approaches?
[04:34:58] qbar: I wanted to know if using through vs not(like the ticketee app) would have any effect on how you interact with the models. @user.projects(where role exists) for example.
[04:36:36] ausum_possum: has joined #RubyOnRails
[04:36:47] ausum_possum: has left #RubyOnRails: ()
[04:39:37] SteenJobs: has joined #RubyOnRails
[04:40:25] roamingd_: has joined #RubyOnRails
[04:40:27] qbar: Now I have to learn how you use Pundit to make https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/app/controllers/projects_controller.rb#L4-L6 return only the current user's projects
[04:41:02] qbar: Thank you so much for your help. This really helped get me on track
[04:41:03] PotatoChipz: has joined #RubyOnRails
[04:41:34] rails112: has joined #RubyOnRails
[04:42:06] roamingdog: has joined #RubyOnRails
[04:42:43] rails112: is there a way to conditionally change the root route? for example, i want the root route to be at /users/sign_up by default. but if the user is already signed in, i want the root route to change to posts#index. how would i do that?
[04:43:32] lightt: has joined #RubyOnRails
[04:45:30] context: rails112: root should redirect to /users/sign_up if the user isnt signed in
[04:46:50] Radar: qbar: Glad you got there :)
[04:47:08] rails112: @context it redirects to /users/sign_in instead with a message "You need to sign in or sign up before continuing". but i want it to go to /users/sign_up instead without displaying any errors
[04:48:39] qbar: Radar: Any tips on which lines I should focus on to understand how to set up pundit to make "@projects = policy_scope(Project)" limit projects to users with roles?
[04:49:13] zave: has joined #RubyOnRails
[04:49:39] pwnd_nsfw`: I wish I had given more attention to deploying applications outside of using heroku lol
[04:49:41] jmignault: has joined #RubyOnRails
[04:49:45] swap_a_b: has joined #RubyOnRails
[04:49:51] qbar: nevermind. I think it is "scope.joins(:roles).where(roles: {user_id: user})"
[04:49:55] pwnd_nsfw`: I'm trying to migrate a site from Heroku to a droplet, but I really just.. have nfi what I'm doing lol
[04:50:00] urbanmonk: has joined #RubyOnRails
[04:50:10] pawnbox: has joined #RubyOnRails
[04:51:12] whathappens: has joined #RubyOnRails
[04:51:41] qbar: rails112: Wouldn't you want the sign_in page(with sign up option) to be the default if not signed in? From a usability standpoint, that makes more sense to me.
[04:52:38] qbar: Sites that default to sign up kind of annoy me. Evernote.com for example.
[04:53:05] emachnic: has joined #RubyOnRails
[04:53:13] pawnbox: has joined #RubyOnRails
[04:54:03] FCser: has joined #RubyOnRails
[04:54:52] rails112: @qbar ahh that makes sense. but how do i get rid of the "You need to sign in or sign up before continuing" message?
[04:55:52] qbar: rails112: Not sure how to edit the devise default pages, but I'm sure you can.
[04:57:18] jenrzzz: has joined #RubyOnRails
[04:57:28] qbar: rails112: This might help, https://github.com/plataformatec/devise/wiki/How-To:-Create-custom-layouts
[04:59:58] qbar: actually, there is a section on customizing views on the devise main page, https://github.com/plataformatec/devise
[05:00:08] qbar: about halfway down
[05:00:22] rails112: @qbar thanks for the link! any way to hide the /users/sign_in part from the url when the user initially visits the site?
[05:01:08] rails112: for instance, if it's www.example.com, i want www.example.com to show the login page if the user isn't signed in, instead of www.example.com/users/sign_in
[05:01:29] pawnbox: has joined #RubyOnRails
[05:01:34] rails112: but if the user is already signed in, i want www.example.com to redirect to posts#index
[05:01:38] rails112: i hope that makes sense
[05:02:26] quazimodo: has joined #RubyOnRails
[05:02:30] quazimod1: has joined #RubyOnRails
[05:02:48] roamingdog: has joined #RubyOnRails
[05:04:19] roamingd_: has joined #RubyOnRails
[05:06:16] qbar: rails112: It does, but I don't know how to do it
[05:08:41] qbar: rails112: something like this maybe? http://stackoverflow.com/questions/19855866/how-to-set-devise-sign-in-page-as-root-page-in-rails
[05:09:35] harfangk: has joined #RubyOnRails
[05:12:59] justrohu: has joined #RubyOnRails
[05:13:13] rails112: @qbar yep, i did something similar to try to solve this. here it is https://gist.github.com/anonymous/cc2268ae005f31baf00998de5bf5053a
[05:13:43] rails112: this got rid of two problems, i) the error is there no longer & ii) i can change the redirect to sign_up if i ever want to
[05:13:55] rails112: but the /users/sign_in is still there in the url
[05:16:05] qbar: rails112: I'm still working on my first rails app, so I'm no expert. Maybe you could put a condition in your index view. If signed in, render the regular page; else render the sign in page.
[05:16:25] qbar: rails112: I'm sure there is a more elegant solution, but that might work
[05:17:26] qbar: rails112: both "pages" would actually be in the same view, but you would only show the appropriate section.
[05:18:13] qbar: I don't really like that approach though.
[05:18:36] AmiMoench: has joined #RubyOnRails
[05:22:39] der-landgraf: has joined #RubyOnRails
[05:22:53] rails112: @qbar yep that would work too! i might be onto something though. any idea what the path for the sign_in page is? i'm trying 'sessions#new' but i'm getting a routing error
[05:25:11] qbar: No. Sorry. I'm just running the default devise setup so far on my app. I've been focused on other things.
[05:25:54] sypheren: has joined #RubyOnRails
[05:28:21] pawnbox: has joined #RubyOnRails
[05:29:36] rails112: @qbar no problem! i just solved it. here's the code in case you want to do something similar in the future -- https://gist.github.com/anonymous/b9937a004cf820e5f19c338492cf3596
[05:30:10] qbar: Awesome!! Glad I could help.
[05:31:17] qbar: There is probably a cleaner way by putting the conditional in the controller, then rendering the appropriate content, but I'm not sure how to do it
[05:32:06] rvanlieshout: has joined #RubyOnRails
[05:32:22] roamingdog: has joined #RubyOnRails
[05:34:20] rails112: @qbar hmm probably. but this should suffice for now haha. i'm particularly new to rails too
[05:34:58] qbar: Your code looks clean to me
[05:40:24] FCser: has joined #RubyOnRails
[05:40:50] roamingdog: has joined #RubyOnRails
[05:41:31] triptec: has joined #RubyOnRails
[05:42:10] Hyuk: has joined #RubyOnRails
[05:45:18] User458764: has joined #RubyOnRails
[05:45:48] SteenJobs: has joined #RubyOnRails
[05:46:55] emilkarl: has joined #RubyOnRails
[05:47:25] ngw: has joined #RubyOnRails
[05:48:57] yfeldblum: has joined #RubyOnRails
[05:50:43] jmignault: has joined #RubyOnRails
[05:51:28] ksmutthu: has joined #RubyOnRails
[05:52:44] Niham: has joined #RubyOnRails
[05:58:51] jm3: has joined #RubyOnRails
[05:59:18] pawnbox: has joined #RubyOnRails
[06:01:39] triptec: has joined #RubyOnRails
[06:03:24] AzaToth: has joined #RubyOnRails
[06:05:44] djbkd: has joined #RubyOnRails
[06:06:00] fujinuma: has joined #RubyOnRails
[06:06:47] AdamOnRails: has joined #RubyOnRails
[06:06:49] whathappens: has joined #RubyOnRails
[06:07:00] fujinuma: would you give me a tutorial about creating a Rails App. with MySQL?
[06:08:57] AdamOnRails: Dang Nabbit. When creating models like: @user = @site.users.create(user_params)
[06:09:12] AdamOnRails: Where User habtm Sites (and vice versa)
[06:09:27] AdamOnRails: It's not populating the join table
[06:09:39] AdamOnRails: pastie incoming...
[06:09:47] AdamOnRails: But this time the other way around
[06:10:04] AdamOnRails: So before I was creating a Site through user, now im looking to create User through Site
[06:10:22] AdamOnRails: I have a feeling tis time is probably just because I'm a "special person" but gimmy a moment...
[06:12:25] yfeldblum: has joined #RubyOnRails
[06:13:20] yfeldblum: has joined #RubyOnRails
[06:15:26] comrad: has joined #RubyOnRails
[06:17:55] AdamOnRails: http://pastie.org/private/hadvwwtwtpavtil9fexeg
[06:20:12] User458764: has joined #RubyOnRails
[06:21:12] eGGshke: has joined #RubyOnRails
[06:23:13] sevenseacat: well it does seem odd to create something and then save it again later - I'd suggest using build if you know you're going to edit it afterwards
[06:23:52] Hyuk: has joined #RubyOnRails
[06:25:23] AdamOnRails: i had used "new" before, had changed to "create" to try debug
[06:25:28] AdamOnRails: will tr build.
[06:29:43] agit0: has joined #RubyOnRails
[06:33:28] User458764: has joined #RubyOnRails
[06:35:27] jeyraof: has joined #RubyOnRails
[06:37:37] ur5us: has joined #RubyOnRails
[06:41:45] emachnic: has joined #RubyOnRails
[06:42:11] dave_352: Anyone know if you can call an endpoint from within the rails c
[06:42:22] dave_352: I've a pesky bug that I'm trying to figure out.
[06:42:22] conta: has joined #RubyOnRails
[06:42:36] dave_352: but it only happens inside a serializer deep down.
[06:42:46] dave_352: An array serializer.
[06:43:42] d0nn1e: has joined #RubyOnRails
[06:46:04] GoranPavlovic: has joined #RubyOnRails
[06:50:28] mixnblend: has joined #RubyOnRails
[06:51:44] jmignault: has joined #RubyOnRails
[06:54:59] universa1: dave_352: why do you need to call an endpoint for that? call the serializer?
[06:56:42] gingray: has joined #RubyOnRails
[06:58:22] Elinos: has joined #RubyOnRails
[06:58:32] yfeldblum: has joined #RubyOnRails
[07:01:21] njero: has joined #RubyOnRails
[07:01:47] Hyuk: has joined #RubyOnRails
[07:06:30] duncannz: has joined #RubyOnRails
[07:09:52] NivenHuH: has joined #RubyOnRails
[07:10:01] arBmind: has joined #RubyOnRails
[07:10:32] User458764: has joined #RubyOnRails
[07:11:52] dezull: has joined #RubyOnRails
[07:12:14] artto: has joined #RubyOnRails
[07:17:07] Ergo: has joined #RubyOnRails
[07:18:07] Pazician: has joined #RubyOnRails
[07:20:56] edwinvdgraaf: has joined #RubyOnRails
[07:22:44] jas02: has joined #RubyOnRails
[07:24:05] binaryplease1: has joined #RubyOnRails
[07:24:52] roamingdog: has joined #RubyOnRails
[07:25:36] edwinvdgraaf: has joined #RubyOnRails
[07:29:05] arBmind1: has joined #RubyOnRails
[07:29:52] Kedare: has joined #RubyOnRails
[07:31:48] upsell5: has joined #RubyOnRails
[07:31:58] AmiMoench: has joined #RubyOnRails
[07:34:41] darutoko: has joined #RubyOnRails
[07:36:16] emachnic: has joined #RubyOnRails
[07:39:35] marr: has joined #RubyOnRails
[07:41:01] darutoko-: has joined #RubyOnRails
[07:42:29] ferr1: has joined #RubyOnRails
[07:44:12] Elinos: has joined #RubyOnRails
[07:47:14] User458764: has joined #RubyOnRails
[07:47:53] ngw: has joined #RubyOnRails
[07:49:55] yfeldblum: has joined #RubyOnRails
[07:50:35] duderonomy: has joined #RubyOnRails
[07:51:34] snoobydoo: has joined #RubyOnRails
[07:52:46] jmignault: has joined #RubyOnRails
[07:54:07] snoobydoo: Hi everyone! Question - I want to implement Liking feature on two of my models: Post and Product. I've made a polymorphic model called `Like` and every post and every product has_many likes, as: likeable. But when i do post.likes I get an error saying "likes.likeable_id" does not exist
[07:54:14] snoobydoo: What am I doing wrong?
[07:54:20] mixnblend: has joined #RubyOnRails
[07:54:44] universa1: snoobydoo: does your likes table have such a column?
[07:55:38] snoobydoo: universa1: No it doesnt. I just have a `id` column in my likes table. I'm a little confused as to how I should be implementing this.
[07:55:39] PotatoChipz: has joined #RubyOnRails
[07:56:08] universa1: snoobydoo: well, if you look at your database and pick a row of the likes table at random
[07:56:17] universa1: how would you know to which "likeable" it belongs?
[07:56:41] Ropeney: snoobydoo, I recon you want a polymorphic assosciation on likes. http://guides.rubyonrails.org/association_basics.html#polymorphic-associations might help you with that
[07:57:22] artto: has joined #RubyOnRails
[07:57:38] snoobydoo: universa1: That makes sense. So if there's a `likeable_id` column, on a post like what should I be saving in there?
[07:57:39] harfangk: has joined #RubyOnRails
[07:58:09] antgel: has joined #RubyOnRails
[07:58:09] universa1: snoobydoo: do you know how a belongs_to association works?
[08:00:37] snoobydoo: Ropeney: I already havea polymorphic association setup on likes, what I'm missing is the right columns that references the post/product.
[08:00:52] blackhuey: has joined #RubyOnRails
[08:01:01] universa1: the columns belong to the setup...
[08:01:03] snoobydoo: universa1: Yes I do. I think i have a fair idea whats going wrong, thanks for the pointers!
[08:01:24] universa1: and the guide also shows what you need.
[08:02:46] chipotle: has joined #RubyOnRails
[08:02:54] djbkd: has joined #RubyOnRails
[08:03:35] edwinvdgraaf: has joined #RubyOnRails
[08:07:34] Ropeney: snoobydoo, the guide showed you what columns you also needed
[08:09:54] DoubleMalt: has joined #RubyOnRails
[08:10:24] sandelius: has joined #RubyOnRails
[08:10:40] snoobydoo: Go it working guys. Thanks Ropeney and universa1!
[08:11:23] gingray: has joined #RubyOnRails
[08:11:25] snowy: has joined #RubyOnRails
[08:12:57] pawnbox: has joined #RubyOnRails
[08:13:48] jsrn: has joined #RubyOnRails
[08:21:41] pawnbox: has joined #RubyOnRails
[08:28:10] Cervajz: has joined #RubyOnRails
[08:33:19] jenrzzz: has joined #RubyOnRails
[08:34:26] Cervajz: has joined #RubyOnRails
[08:41:05] apeiros: I have the same issue as described in https://github.com/rails/rails/issues/16125
[08:41:12] Psy-Q: has joined #RubyOnRails
[08:41:37] apeiros: pixeltrix claims it's not a bug. IMO it's quite clearly a bug. but since he says we should ask here first, I do so - any idea on how to handle this?
[08:41:44] timmyBsd: has joined #RubyOnRails
[08:42:02] apeiros: in my case, the bug means that I can't create associated models
[08:43:56] universa1: apeiros: well, you're breaking the convention of the inheritance column containing the model name
[08:44:13] artto: has joined #RubyOnRails
[08:44:20] universa1: apeiros: why not just add the default type column?
[08:44:24] apeiros: i.e., expanding on the given example (doing it ad-hoc, so I hope I do it right): Product.has_one :currency, class_name: 'Code'; Product.accepts_nested…; Product.new(currency_attributes: {units: '$'}) # will raise the same exception
[08:44:33] apeiros: universa1: because this is not purely a rails app
[08:44:43] apeiros: universa1: and class names are rather meaningless to anything except rails
[08:44:56] arBmind: has joined #RubyOnRails
[08:45:29] apeiros: so either I have redundant information (i.e. map the class name to a code and thus have 2 columns), or I use a way to override single inheritance resolution
[08:45:51] apeiros: and given that sti_name and find_sti_class exist and are used, I'd say the omission of that in *one single case* is pretty much a bug.
[08:45:53] universa1: apeiros: well, rails mostly cares "only about itself", no offense meant
[08:46:20] apeiros: universa1: sure. but why provide those two methods and only do it half-assed? as said, IMO a bug. either remove those entirely or implement it correctly. no?
[08:46:32] universa1: apeiros: so write a patch? show that it works the same, ...
[08:46:36] apeiros: patch exists
[08:46:42] apeiros: that guy provided one
[08:46:56] universa1: apeiros: s/patch/pull request/
[08:47:02] apeiros: I think he did even that
[08:47:11] apeiros: second, phone call :-S
[08:48:49] dalpo: has joined #RubyOnRails
[08:50:19] dalpo: I'm having a lot of failing specs after the upgrade to rails-5.rc2
[08:50:33] universa1: you upgraded from where?
[08:50:46] dalpo: From rails-5.rc1
[08:51:00] universa1: you only updated rails?
[08:51:23] rvanlieshout: dalpo: start with the first failing spec
[08:51:25] rvanlieshout: why does it fail?
[08:51:35] dalpo: Failures:
[08:51:35] dalpo: 1) Admin::ColorPalettesController POST #create with NOT authenticated user should redirect to the login page
[08:51:38] dalpo: Failure/Error: post :create, params: { color_palette: valid_attributes }
[08:51:40] dionysus69: has joined #RubyOnRails
[08:51:43] dalpo: ActionDispatch::IllegalStateError:
[08:51:44] universa1: dalpo: !gist
[08:51:45] helpa: dalpo: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[08:51:46] dalpo: header already sent
[08:52:09] dalpo: I'll create a gist
[08:52:45] jhass: apeiros: wow that's pretty dismissive behavior there tbh
[08:52:53] jhass: from pixeltrix
[08:53:17] apeiros: jhass: (still phone) it's my standard experience with pixeltrix tbh
[08:53:25] apeiros: main reason I stopped bothering writing patches for rails
[08:53:35] jmignault: has joined #RubyOnRails
[08:53:47] pawnbox: has joined #RubyOnRails
[08:53:48] apeiros: so, phone call done
[08:54:26] fermonkus: has joined #RubyOnRails
[08:54:29] apeiros: let me search the patch/pr from ericroberts…
[08:54:49] universa1: i guess a pull request would have better chances, if it not only added support for an edge case, which is outside the rails conventions, but also improves the default behavior/implementation
[08:55:04] apeiros: https://github.com/rails/rails/compare/master...ericroberts:sti-class-name
[08:55:17] jhass: universa1: no offense, did you take time to read and understand the linked issue?
[08:55:19] dalpo: here wyou can find the stack trace
[08:55:20] dalpo: https://gist.github.com/dalpo/66824995f6b3509acad444d46fa42da2
[08:55:36] universa1: jhass: yes i did.
[08:55:49] fox_mulder_cp: does somebody user rails 5 rc with devise from git? have a exeption 'raise ActionController::InvalidAuthenticityToken' in chrome
[08:55:57] jhass: universa1: I think this hardly can be called an edge case
[08:56:09] universa1: jhass: so the use case is clearly outside of what the rails convention for polymorphic association is.
[08:56:18] universa1: jhass: use case is the wrong word
[08:56:21] apeiros: universa1: um no
[08:56:31] apeiros: universa1: that's a very narrow way to view the world
[08:56:43] universa1: rails convention is: "type" column contains "class name" ...
[08:56:52] jhass: universa1: and yet there's partial support for what you consider "completely wrong"
[08:57:09] fox_mulder_cp: in FF seems ok when post a form
[08:57:15] apeiros: universa1: then why are there find_sti_class and sti_name?
[08:57:22] jhass: either that partial support should be stripped or it should be valid use of rails, in all situations
[08:57:29] universa1: apeiros: i don't know.
[08:57:36] apeiros: universa1: either your description of the convention is wrong or those two shouldn't exist
[08:57:57] jhass: "convention over configuration" != "convention and no configuration"
[08:57:59] universa1: jhass, apeiros that is why i wrote the thing with better chances.
[08:58:08] apeiros: and since those exist I'd say the convention is "type can be inferred from the attributes, default is class name is in a column called type"
[08:58:53] apeiros: universa1: and if you remember, there's plenty of rails conventions which have defaults, but overridable defaults. the two overridable defaults in the above are "mechanism to map value to class and vice versa" and "column in which type information is stored"
[08:59:01] apeiros: universa1: and the part "mechanism" is broken
[08:59:05] roamingdog: has joined #RubyOnRails
[08:59:40] artto: has joined #RubyOnRails
[08:59:53] apeiros: (mechanism being those two methods, sti_name and find_sti_class - in case that's not obvious)
[09:00:36] universa1: apeiros: don't get me wrong, i'm in no way against allowing "your behavior", i was just trying to show another point of view, which might have triggered the response the ticket got in the first place.
[09:01:01] apeiros: universa1: again, that response makes no sense given those two methods
[09:01:17] apeiros: so I can't share that "other point of view"
[09:01:33] universa1: you don't have to.
[09:01:50] quazimodo: has joined #RubyOnRails
[09:01:51] FLeiXiuS: has joined #RubyOnRails
[09:01:57] FLeiXiuS: has joined #RubyOnRails
[09:01:58] apeiros: and you - as you said yourself - can't give a coherent explanation for the existence of those two methods either…
[09:01:58] quazimod1: has joined #RubyOnRails
[09:02:42] apeiros: universa1: right, I don't have to. but I have to have a solution for the problem.
[09:02:43] harfangk: has joined #RubyOnRails
[09:02:54] FLeiXiuS: When using .where.not(foo: 'bar') - why is it not listing records found where foo is nil? http://pastie.org/10887526
[09:02:59] Cervajz_: has joined #RubyOnRails
[09:04:22] mikecmpbll: has joined #RubyOnRails
[09:07:06] norc: has joined #RubyOnRails
[09:08:10] rvanlieshout: FLeiXiuS: that's by design
[09:08:32] rvanlieshout: in sql WHERE foo = 'bar' OR foo <> 'bar' does not return where foo IS NULL
[09:08:55] FLeiXiuS: Interesting .
[09:09:06] FLeiXiuS: Guess I'll approach it differently.
[09:09:06] rvanlieshout: null means it has no data
[09:09:11] rvanlieshout: so it's not equal or unequal to
[09:09:56] norc: I have a naming question. I have two models like this: https://gist.github.com/anonymous/dbd37d282361adb965727fcd5a2c6b92
[09:10:00] dionysus69: has joined #RubyOnRails
[09:10:10] norc: What is a reasonable name for both has_many in Facility?
[09:11:36] norc: Oh! I think I have it nevermind.
[09:11:50] norc: active_loop_pathways and passive_loop_pathways seems like a good fit.
[09:14:09] Ergo: has joined #RubyOnRails
[09:14:54] Depili: has joined #RubyOnRails
[09:16:47] tennis: has joined #RubyOnRails
[09:17:26] adac: has joined #RubyOnRails
[09:20:00] ur5us: has joined #RubyOnRails
[09:20:32] adac: Hi! When I try to migrate my database I get the following error: "failed to execute: pg_dump -s -x -O -f /home/project/project/db/structure.sql --schema=public project_test Please check the output above for any errors and make sure that `pg_dump` is installed in your PATH and has proper permissions." Any ideas what I can do about this? I'm on rails 4.2.6 btw
[09:21:45] adac: There was a problem on this once, but this seemed to have been solved: https://github.com/rails/rails/issues/23141
[09:22:45] norc: adac: do you have permissions to execute pg_dump ?
[09:22:52] tildes: has joined #RubyOnRails
[09:23:11] oystersauce8: has joined #RubyOnRails
[09:24:22] emachnic: has joined #RubyOnRails
[09:25:24] AimlessRAven: has joined #RubyOnRails
[09:25:33] PotatoChipz: return 'foo' if array.include?('foo')
[09:25:34] PotatoChipz: -- is there a shortcut for this in Ruby?
[09:25:35] PotatoChipz: something like with Hash it has, array.fetch(:foo, nil)
[09:27:11] adac: norc, It seems that the user which I'm running the migration can execute pg_dump just fine
[09:27:21] AimlessRAven: hi all, how to create polymorphic model when i generate mode
[09:27:28] AimlessRAven: polymorphic: true ?
[09:27:39] srinidhi: has joined #RubyOnRails
[09:27:58] fermonkus: has joined #RubyOnRails
[09:28:17] voidDotClass: has joined #RubyOnRails
[09:31:05] norc: adac: run the entire command as specified in the output
[09:31:09] norc: adac: see what happens.
[09:32:34] adac: norc, I have just seen that the pg_dump binary was not installed before. Was looking at an older log. The error still persists now when I installed it, however I addionally get: pg_dump: server version: 9.5.3; pg_dump version: 9.4.8
[09:32:41] adac: pg_dump: aborting because of server version mismatch
[09:32:44] yfeldblum: has joined #RubyOnRails
[09:32:51] adac: i need to install a newer version and see how it goes
[09:33:48] mikecmpbll: potatochipz: you could do array.find{ |i| i == "foo" }
[09:33:53] norc: adac: One thing Im curious. The error message even told you what to do. Why did you still have no idea what you can do about it?
[09:34:01] norc: Note this is an honest question.
[09:34:44] mikecmpbll: nevar trust the computor!
[09:35:19] adac: norc, I was not aware first that the pg_dump binary as needed to be installed via OS package manager
[09:36:34] adac: locally I just had it installed by default and it got just used obviously
[09:41:42] ksmutthu: has joined #RubyOnRails
[09:42:36] adac: norc Note: these are honest answers
[09:43:05] norfumpit: has joined #RubyOnRails
[09:46:26] norc: adac: it does not have to be installed via OS package manager.
[09:46:44] norc: adac: As the error message quite clearly indicated, it assumes the binary to be in $PATH
[09:47:09] adac: norc, where does the binary then come from?
[09:47:47] norc: adac: wherever its found in PATH first.
[09:48:16] norc: adac: or to rephrase: whichever directory first contains it in your PATH.
[09:48:37] adac: norc, I assume locally it is just using the binary from the package that was installed via my OS.
[09:49:19] norc: adac: Possibly. Type "which pg_dump" to find out.
[09:49:56] adac: /usr/bin/pg_dump
[09:52:09] Pazician: has joined #RubyOnRails
[09:52:11] norc: adac: Then it's likely, depending on what operating system you are running. :)
[09:52:58] edwinvdg_: has joined #RubyOnRails
[09:54:19] jmignault: has joined #RubyOnRails
[09:54:24] _Tariq: has joined #RubyOnRails
[09:55:35] User458764: has joined #RubyOnRails
[09:57:27] adac: norc, ubuntu ;)
[09:57:49] weckl: has joined #RubyOnRails
[10:00:14] dionysus69: ok I have a really annoying thing going on. I have two controllers divided with admin namespace. here are routes and two controllers https://gist.github.com/anonymous/09f5353fe950cb1c26bda2c9234e1ba0. thing is that when I submit an edit form from admin template, it redirects me to the json show action. which doesnt make any sense. Please give me a hint as to why this might be happening??
[10:01:46] dionysus69: to clarify, update action in admin/controller redirects to controller - show
[10:01:58] agit0: has joined #RubyOnRails
[10:03:04] norc: dionysus69: can you attach the output of rake routes?
[10:03:37] norc: dionysus69: also include the code that creates the form you mentioned.
[10:05:32] andromedian: has joined #RubyOnRails
[10:06:06] andromedian: do you know how I can display the value of the additional_sizes it seems they are coming from a rails model https://gist.github.com/anonymous/8c1cf2dfc9fe72be23cbe03ad9793bc8 I'm getting right now #<Property::AdditionalSize:0x007f88148fc2c8> if I true to use an each loop on object.additional_sizes ?
[10:06:33] andromedian: if i try to use*
[10:07:25] norc: andromedian: Please include the actual code from whatever is related to this. Models, controllers, views.
[10:07:32] lxsameer: has joined #RubyOnRails
[10:07:32] lxsameer: has joined #RubyOnRails
[10:08:22] dionysus69: norc here it is
[10:08:23] dionysus69: https://gist.github.com/anonymous/e933a0ce1f5e75dad5582f6fc1c5c65d
[10:08:28] artto: has joined #RubyOnRails
[10:09:13] norc: dionysus69: What URL does the log show for the request that is routed wrongly?
[10:09:30] norc: (And HTTP verb for completeness)
[10:09:34] andromedian: thanks again norc I will try to do that.
[10:10:49] c355E3B: has joined #RubyOnRails
[10:11:08] pawnbox: has joined #RubyOnRails
[10:12:22] dionysus69: norc: as I understand it should go to http://localhost:3000/en/admin/news/1 and NOT http://localhost:3000/en/news/1 as it currently does. http://localhost:3000/en/news/1 this is a jason show route
[10:12:45] quazimodo: has joined #RubyOnRails
[10:12:49] quazimod1: has joined #RubyOnRails
[10:13:08] norc: dionysus69: I think there has been a mixup between us.
[10:13:25] edwinvdgraaf: has joined #RubyOnRails
[10:13:56] norc: dionysus69: You said some request ends up in the wrong controller/action. What HTTP verb/URL are you sending on that request? Please copy this from your log.
[10:14:30] dionysus69: I am sending update
[10:14:45] norc: What HTTP verb/URL are you sending on that request? Please copy this from your log.
[10:15:01] norc: I can repeat myself again if you like.
[10:15:03] dionysus69: update action in admin news controller says that on successful edit it should redirect to Admin/news/show and now /news/show
[10:15:11] norc: What HTTP verb/URL are you sending on that request? Please copy this from your log.
[10:15:15] dionysus69: on the end of form submit this is logging [active_model_serializers] Rendered NewsSerializer with ActiveModelSerializers::Adapter::JsonApi (2.56ms)
[10:16:02] dionysus69: I am not manually sending any verb, update action assumingly sends update verb
[10:16:28] norc: dionysus69: What?
[10:16:32] dionysus69: Started GET "/en/admin/news/1/edit" for ::1 at 2016-06-23 14:16:05 +0400
[10:16:37] norc: Thank you.
[10:16:37] dionysus69: so its a get request
[10:17:09] dionysus69: and do you agree? it doesnt make sense that it redirects to the /en/news/1 and not /en/admin/news/1 instead
[10:18:04] dionysus69: this doesnt cause any problem, it is just so weird that I am curious why this is happening
[10:21:42] Hyuk: has joined #RubyOnRails
[10:23:25] andromedian: norc, https://gist.github.com/anonymous/2d68a806a128eaa8d2f7b60f58c2a549 so I'm trying to get @property.additional_sizes and I get in the view #<Property::AdditionalSize:0x007f88148fc2c8>#<Property::AdditionalSize:0x007f88148fc048>
[10:23:58] pwnd_nsfw: has joined #RubyOnRails
[10:25:18] k3rn31: has joined #RubyOnRails
[10:27:01] bbrowning: has joined #RubyOnRails
[10:28:11] edwinvdgraaf: has joined #RubyOnRails
[10:29:51] jmignault: has joined #RubyOnRails
[10:29:53] GodFather: has joined #RubyOnRails
[10:29:59] pawnbox: has joined #RubyOnRails
[10:32:19] artto_: has joined #RubyOnRails
[10:33:45] User458764: has joined #RubyOnRails
[10:34:22] User458764: has joined #RubyOnRails
[10:38:08] DoubleMalt: has joined #RubyOnRails
[10:38:52] artto: has joined #RubyOnRails
[10:39:15] siaw23: has joined #RubyOnRails
[10:42:30] DTZUBDUB: has joined #RubyOnRails
[10:44:06] artto: has joined #RubyOnRails
[10:45:46] norc: andromedian: Not sure what nested_attribute_lists is.
[10:46:30] andromedian: Thanks again norc I will try to figure out.
[10:46:46] norc: dionysus69: Can you include the definition of your Admin::ApplicationController?
[10:47:03] norc: andromedian: This by the way is what I meant by "check your libraries manual"
[10:48:34] dionysus69: class Admin::ApplicationController < ApplicationController
[10:48:34] dionysus69: before_action :authenticate_user!
[10:48:51] dionysus69: does that matter though?
[10:49:36] dionysus69: I found another misbehavior in about route. when I am on about index route and click on any object show, it renders show from non admin controller, which leads to json again
[10:49:48] artto: has joined #RubyOnRails
[10:50:05] Pumukel: has joined #RubyOnRails
[10:50:09] dionysus69: in fact I think all admin show actions are rendering json
[10:50:45] norc: dionysus69: Please attach the full log for the request in question to your gist.
[10:50:50] norc: And please do not open *another*.
[10:51:44] flopsec: has joined #RubyOnRails
[10:52:38] dionysus69: https://gist.github.com/anonymous/094d2a21b36e32bc0df4a6bda81c1f82
[10:52:55] dionysus69: this is happening after submit button on admin/edit/form
[10:53:18] User458764: has joined #RubyOnRails
[10:54:34] norc: dionysus69: Started PATCH "/en/news/1" f
[10:54:37] arup_r: has joined #RubyOnRails
[10:54:38] norc: dionysus69: why did you lie to me?
[10:54:47] King_Rex: has joined #RubyOnRails
[10:55:13] moeabdol: has joined #RubyOnRails
[10:55:18] t_p: has joined #RubyOnRails
[10:55:22] norc: dionysus69: [12:16] <dionysus69> Started GET "/en/admin/news/1/edit" for ::1 at 2016-06-23 14:16:05 +0400
[10:55:26] norc: dionysus69: That is not in the log.
[10:56:07] dionysus69: I guess I accidentally copied a request following that one, wasnt intentional sorry :S
[10:56:37] dionysus69: anyways, what does that tell us?
[10:57:02] norc: What does what tell us
[10:57:08] norc: Which is correct?
[10:57:13] dionysus69: that it was patch instead of get
[10:57:23] norc: dionysus69: Started PATCH "/en/news/1"
[10:57:25] norc: Routing is working fine.
[10:57:40] norc: Processing by NewsController#update as HTML
[10:57:41] dionysus69: yes but why does it not render show action from admin?
[10:57:49] norc: dionysus69: Look again.
[10:58:37] norc: dionysus69: You request PATCH "/en/news/1" which is fulfilled by the following route:
[10:58:38] pawnbox: has joined #RubyOnRails
[10:58:38] norc: https://gist.github.com/anonymous/e933a0ce1f5e75dad5582f6fc1c5c65d#file-routes-output-L78
[10:58:45] norc: dionysus69: So your form is wrong.
[10:59:32] dionysus69: those two namespaced controllers are supposed to handle same model
[10:59:35] dionysus69: if I missed to say
[11:00:05] dionysus69: but when I am using update action from admin, it should automatically render the view from admin namespace and not json
[11:00:17] dionysus69: thats the part that I am confused about
[11:00:25] norc: dionysus69: form_for [:admin, admin_news], multipart: true
[11:00:38] roamingdog: has joined #RubyOnRails
[11:01:01] dionysus69: thanks allot :D I knew I was missing something like that :)
[11:01:22] norc: dionysus69: So. Next time first look at the log - and understand whats happening.
[11:03:17] DTZUBDUB: has joined #RubyOnRails
[11:05:43] rodfersou: has joined #RubyOnRails
[11:09:07] arunpyasi: has joined #RubyOnRails
[11:09:15] dstarh: has joined #RubyOnRails
[11:10:03] dionysus69: after I added that admin namespace to the form object I am getting this error now param is missing or the value is empty: admin_news --- heres the controller too
[11:10:03] dionysus69: https://gist.github.com/anonymous/c593f4b0186e3b52060a691219ad09f5
[11:10:55] dionysus69: if I change :admin_news to just :news then the form still redirects to the json view
[11:11:35] AmiMoench: has joined #RubyOnRails
[11:12:01] norc: dionysus69: again. start by looking at your log.
[11:12:02] drptbl: has joined #RubyOnRails
[11:12:15] norc: dionysus69: dont jump the queue. start with your log. start understanding what is happening.
[11:12:30] dionysus69: ok I ll try :)
[11:12:39] allcentury: has joined #RubyOnRails
[11:13:30] norc: dionysus69: the error you are getting is strong params validation. You told the controller that "admin_news" is required - but somehow its not present. So take a look at what is being sent.
[11:13:31] emachnic: has joined #RubyOnRails
[11:14:01] dionysus69: ok here it is Started PATCH "/en/admin/news/1" which doesn't exist, I want it to patch Started PATCH "/en/news/1" and then redirect to "/en/admin/news/1" if its not possible like that, i am fine with it, I just need to know :D
[11:14:57] norc: dionysus69: Too fast.
[11:15:00] t_p: has joined #RubyOnRails
[11:15:02] norc: dionysus69: Read my last message.
[11:15:24] norc: dionysus69: Oh.
[11:15:35] norc: Well that is a different problem.
[11:16:14] dionysus69: but is it doable? I am just doing this for interest, I can totally remove admin controller show action and be fine with it
[11:16:48] norc: dionysus69: you can redirect request all you want.
[11:17:18] norc: (Do not understand this as a hint that what you are doing is a great idea)
[11:18:49] dionysus69: ok thanks for support :) I ll tinker with it some more until I am bored x)
[11:20:17] camilasan: has joined #RubyOnRails
[11:22:43] artto_: has joined #RubyOnRails
[11:24:59] artto: has joined #RubyOnRails
[11:26:27] AimlessRAven: hi all, i have admin model and post model with references belongs_to has_many
[11:26:48] AimlessRAven: ho to make when i create post current_admin to be post owner
[11:27:01] AimlessRAven: eg. in my post model admin_id field to figure current_admin id
[11:28:17] norc: AimlessRaven: How do you get the ID of current admin?
[11:30:08] nachoman: has joined #RubyOnRails
[11:30:52] AimlessRAven: norc: nothing .. i want automaticly
[11:31:02] AimlessRAven: and i need to make that in my posts create action
[11:31:09] AimlessRAven: after save to update this field to the ucrrent_admin id ?
[11:31:22] AimlessRAven: but when make new post from console..
[11:32:52] Mia: has joined #RubyOnRails
[11:32:52] Mia: has joined #RubyOnRails
[11:36:03] FernandoBasso: has joined #RubyOnRails
[11:36:36] raidiant: has joined #RubyOnRails
[11:37:07] zel: has joined #RubyOnRails
[11:37:59] AimlessRAven: norc: do you know
[11:38:05] AimlessRAven: whats the right way to do that
[11:38:20] norc: Based on your descriptive description it is clear what caused your crash.
[11:39:33] ldnunes: has joined #RubyOnRails
[11:39:44] Detch: has joined #RubyOnRails
[11:39:56] AimlessRAven: ok i have model Admin and model Post, admin has_many posts, post belongs_to admin
[11:40:00] AimlessRAven: now i want when create new post
[11:40:08] AimlessRAven: to automaticcly assign current_admin to this post
[11:40:19] AimlessRAven: in my post admin_id field
[11:41:01] jhass: current_admin.posts.create(post_params)
[11:41:33] ngw: has joined #RubyOnRails
[11:42:49] artto: has joined #RubyOnRails
[11:43:51] pwnd_nsfw`: has joined #RubyOnRails
[11:44:00] AmiMoench: has joined #RubyOnRails
[11:47:56] Madzz: has joined #RubyOnRails
[11:48:44] rodferso1: has joined #RubyOnRails
[11:48:58] puce: has joined #RubyOnRails
[11:51:34] pwnd_nsfw: has joined #RubyOnRails
[11:52:31] puce: has joined #RubyOnRails
[11:52:33] srinidhi: has joined #RubyOnRails
[11:52:44] eGGshke: has joined #RubyOnRails
[11:52:51] sevenseacat: has joined #RubyOnRails
[11:54:04] Hyuk: has joined #RubyOnRails
[11:57:16] drptbl: has joined #RubyOnRails
[12:03:53] ElFerna: has joined #RubyOnRails
[12:05:23] Hyuk: has joined #RubyOnRails
[12:07:57] voidDotClass: has joined #RubyOnRails
[12:09:43] sergio_101: has joined #RubyOnRails
[12:10:15] wd40s: has joined #RubyOnRails
[12:15:13] AimlessRAven: I have admin model - has_many posts, and post model - belongs_to admin. in my relation i can call @admin.posts, but cant call @post.admin
[12:15:34] AimlessRAven: after create new post, my admin_id field in post model is nil
[12:16:14] norc: jhass: That is neat. Wasn't aware you could create an associated model that way. :)
[12:16:30] conta: has joined #RubyOnRails
[12:19:00] jhass: AimlessRaven: how do you create a new post?
[12:21:52] rodferso1: has joined #RubyOnRails
[12:21:58] emachnic: has joined #RubyOnRails
[12:22:14] dionysus69: norc I figured it out!
[12:22:36] norc: dionysus69: The problems you figure out yourself are the best. :)
[12:22:46] dionysus69: redirect_to @admin_about_section correctly redirects to json since the var itself redirect_to @admin_about_section saves the non admin object
[12:23:04] norc: No idea what that meant.
[12:23:09] dstarh: has joined #RubyOnRails
[12:23:11] norc: But nice that you figured it out.
[12:26:27] mdw: has joined #RubyOnRails
[12:26:54] centrx: has joined #RubyOnRails
[12:28:16] AimlessRAven: jhass: im with simple form
[12:28:42] AimlessRAven: but i want to default my field admin_id in post model relation to be this admin who make post!
[12:31:56] Cork: in this situation i want to set user_id in profile when i create a new user with a profile https://pastebin.mozilla.org/8879085
[12:32:08] Cork: is there a way to do that cleanly in rails?
[12:32:45] Cork: user = User.new; user.build_profile(user_id: ??)
[12:35:48] SteenJobs: has joined #RubyOnRails
[12:36:10] oystersauce8: has joined #RubyOnRails
[12:36:42] flashpoint9: has joined #RubyOnRails
[12:38:24] JamieD: has joined #RubyOnRails
[12:38:43] Hyuk: has joined #RubyOnRails
[12:41:20] piotrj: has joined #RubyOnRails
[12:43:32] pawnbox: has joined #RubyOnRails
[12:44:03] piotrj: has joined #RubyOnRails
[12:46:17] rubyonrailed: has joined #RubyOnRails
[12:46:37] fmcgeough: has joined #RubyOnRails
[12:48:16] User458764: Hi, how do you render via HTTP and in HTML a Mailer view as there is no controller?
[12:50:11] Charles_CV: has joined #RubyOnRails
[12:55:17] SteenJobs: has joined #RubyOnRails
[12:56:30] pawnbox: has joined #RubyOnRails
[12:57:10] Hyuk: has joined #RubyOnRails
[12:58:19] arunpyasi: has joined #RubyOnRails
[12:59:44] mixnblend: has joined #RubyOnRails
[13:00:58] k3rn31: has joined #RubyOnRails
[13:01:31] jhass: write one?
[13:01:55] _Tariq: has joined #RubyOnRails
[13:03:06] kitsuneyo: has joined #RubyOnRails
[13:03:24] roamingdog: has joined #RubyOnRails
[13:03:48] User458764: jhass ok thanks
[13:03:53] edwinvdgraaf: has joined #RubyOnRails
[13:04:58] darutoko: has joined #RubyOnRails
[13:07:22] conta: has joined #RubyOnRails
[13:09:20] Hyuk: has joined #RubyOnRails
[13:11:11] futilegames: has joined #RubyOnRails
[13:13:43] rueben: has joined #RubyOnRails
[13:16:18] artto: has joined #RubyOnRails
[13:17:22] yellow5: has joined #RubyOnRails
[13:18:11] mdw: has joined #RubyOnRails
[13:18:45] fryguy: sign, moving a rails site from one set of servers to another and perf is worse and I haven't figured out why. I'm hoping it's just memcached warming
[13:24:32] GodFather: has joined #RubyOnRails
[13:24:36] akshat: has joined #RubyOnRails
[13:26:45] edwinvdgraaf: has joined #RubyOnRails
[13:28:20] umdstu: has joined #RubyOnRails
[13:31:38] aegis3121: has joined #RubyOnRails
[13:32:26] piotrj: has joined #RubyOnRails
[13:32:29] Hyuk: has joined #RubyOnRails
[13:33:49] pawnbox: has joined #RubyOnRails
[13:34:47] AmiMoench: has joined #RubyOnRails
[13:36:36] piotrj: has left #RubyOnRails: ()
[13:37:47] jowiar: has joined #RubyOnRails
[13:40:56] jto: has joined #RubyOnRails
[13:44:33] artto: has joined #RubyOnRails
[13:44:35] sarink: has joined #RubyOnRails
[13:46:22] artto: has joined #RubyOnRails
[13:49:37] artto_: has joined #RubyOnRails
[13:49:58] User458764: How do I return arbitrary data from a model, I don't want to map a database
[13:51:05] norc: User458764: Don't use ActiveRecord
[13:51:13] norc: User458764: your models are just classes.
[13:51:59] rvanlieshout: User458764: and include whatever you want from ActiveModel
[13:52:32] andromedian: has joined #RubyOnRails
[13:53:13] emilkarl: has joined #RubyOnRails
[13:55:03] fox_mulder_cp: i have a web_app class with nested iplist class, but when i touch update_properties, i see, that web_app class can'tr update, but iplist updated with web_app id. gist here https://gist.github.com/foxmuldercp/2d2b73d3501a3b70df6a4b041eabd111
[13:55:44] fox_mulder_cp: what i loss for to do?
[13:56:56] brazenbraden: has joined #RubyOnRails
[13:58:02] brazenbraden: i have accept_nested_attributes_for :socials, reject_if: :all_blank, however, validation is failing even though all social fields are indeed blank. is it because im doing create!() instead of create()?
[13:58:02] alfiemax: has joined #RubyOnRails
[13:59:59] fox_mulder_cp: BrazenBraden: hm... if u want build nested object - use build https://gist.github.com/foxmuldercp/47d5c7d24afe8051e4b933f460a8075d
[14:00:08] jgt: has joined #RubyOnRails
[14:00:53] piotrj: has joined #RubyOnRails
[14:01:33] brazenbraden: fox_mulder_cp, thanks for the response. I'm using cocoon (well, a modified version but same idea) which means i dont need to build a set number of fields_for
[14:01:47] Detch: has joined #RubyOnRails
[14:02:10] brazenbraden: fox_mulder_cp, changed occupations since the end of x-files? :P
[14:03:49] context: yeah, he is chasing down serial killers now
[14:04:08] roamingdog: has joined #RubyOnRails
[14:04:13] brazenbraden: a worthy quest
[14:04:35] apeiros: I'm still watching his quest through california
[14:05:05] brazenbraden: im a tad out of the media loop
[14:05:07] rubyonrailed: has joined #RubyOnRails
[14:05:44] arunpyasi: has joined #RubyOnRails
[14:08:24] asheinfeld: has joined #RubyOnRails
[14:08:35] Cervajz: has joined #RubyOnRails
[14:08:40] Malgorath: has joined #RubyOnRails
[14:09:02] flashpoint9: has joined #RubyOnRails
[14:09:30] fox_mulder_cp: BrazenBraden: $)
[14:10:03] fox_mulder_cp: but where i failed with my relation...
[14:10:41] allcentury: has joined #RubyOnRails
[14:11:01] Malgorath: I am trying to change in a resources 'task_list' to allow the :id be read from :tlid as I'm using :id for something else. Is this possible?
[14:12:16] VeryBewitching: has joined #RubyOnRails
[14:12:20] kailido: has joined #RubyOnRails
[14:12:42] tbuehlmann: Malgorath: this? http://guides.rubyonrails.org/routing.html#overriding-named-route-parameters
[14:14:20] Malgorath: tbuehlmann, thanks, I forgot to put on :tlid when I first tried that, missed the : that is
[14:15:52] harfangk: has joined #RubyOnRails
[14:15:58] kailido: hi, I am ordering my posts hierarchly with ancestry gem
[14:16:37] afdafdafd: has joined #RubyOnRails
[14:16:49] kailido: but it only works with a single parent. but I have some posts with multiple parents. can I join two different gems or something to the repeated childs ?
[14:17:38] adre: has joined #RubyOnRails
[14:19:21] Oliphaunte: has joined #RubyOnRails
[14:20:29] fox_mulder_cp: kailido: ooh. one for many...
[14:21:37] jtong_: has joined #RubyOnRails
[14:21:43] kailido: this is on the same table
[14:22:31] fox_mulder_cp: kailido: wait, i search how i do it
[14:23:04] pawnbox: has joined #RubyOnRails
[14:23:16] macsteps: has joined #RubyOnRails
[14:23:48] shinnya: has joined #RubyOnRails
[14:23:50] apeiros: uuuuh, wth? when I do my_model.to_json(include: [:foo]), my_model.foo's as_json is not invoked?
[14:23:56] fox_mulder_cp: http://stackoverflow.com/questions/8236796/writing-associations-for-a-recursive-relationship
[14:24:02] mrbubbles: has joined #RubyOnRails
[14:24:40] apeiros: same with .as_json(include: …)
[14:24:49] fox_mulder_cp: kailido: in my code i have a one client as reseller for some non-reseller client
[14:24:50] apeiros: that seems to make the whole idea of as_json quite a lot less useful?
[14:25:00] jscheel: has joined #RubyOnRails
[14:25:21] fox_mulder_cp: kailido: but after some code i drop thi idea and switch to defferent model for client and reseller
[14:25:55] mrbubbles: Hello - so I have a const that stores an array of chart types: [chart_type_1, chart_type_2] etc. that exist in my system. some users will see all the chart types, but some will only see a subset. am I best off including a column alongside each user in my table show_chart_1, show_chart2, etc or am i better off creating a charts table, a user_charts table and then creating the relationships through that? thanks
[14:25:55] mrbubbles: for any advice
[14:28:06] triptec: has joined #RubyOnRails
[14:28:27] eljimmy: has joined #RubyOnRails
[14:28:55] Zadrel: has joined #RubyOnRails
[14:29:36] sarink: has joined #RubyOnRails
[14:30:38] universa1: apeiros: hmm... as_json calls serializable_hash under the hood, which it also calls for the included records
[14:31:32] arunpyasi: has joined #RubyOnRails
[14:33:05] apeiros: universa1: ok, so the proper way would be to implement serializable_hash instead of as_json?
[14:33:58] universa1: apeiros: hmm... in my very personal opinion i don't use as/to_json anyways. json for me is more like html, just a view and i prefer to handle it there :-)
[14:34:18] universa1: apeiros: so i'm somewhat clueless about the proper way on the model level.
[14:34:45] apeiros: I use presenters for anything non-canonical. but for the canonical object, I use model.to_json
[14:35:19] universa1: and i've no clue if something else uses serializable hash
[14:35:51] apeiros: ok, well, thanks for the pointer. let's see whether the docs have something on it :)
[14:35:59] universa1: model.as_json include: {foo: {only: [:bar, :muh]}} as a work around
[14:36:18] rueben: has joined #RubyOnRails
[14:36:18] universa1: http://api.rubyonrails.org/classes/ActiveModel/Serialization.html#method-i-serializable_hash
[14:36:36] sarink: has joined #RubyOnRails
[14:36:37] dnjo: has joined #RubyOnRails
[14:36:43] apeiros: yeah, already been there. not much info :-/
[14:37:08] Malgorath: is it better to have 2 form_for statements when I'm needing to pass a params[:tlid] inside the url?
[14:37:18] universa1: Malgorath: context?!
[14:38:05] universa1: form_for blub, url: params[:tlid] ? blub_url(params[:tlid]) : bar_url
[14:38:35] Malgorath: universa1, https://gist.github.com/malgorath/e28e42480185698c546bc7a8328933a2 here is the form, it works for doing new, but on update it does not have the tlid param I need to do the update
[14:39:19] universa1: Malgorath: so pass a different url if the rest is the same?
[14:40:02] adavia: has joined #RubyOnRails
[14:40:18] Malgorath: universa1, this is #new /projects/:id/task_lists(.:format) #update => /projects/:id/task_lists/:tlid(.:format)
[14:40:42] universa1: my answer remains the same.
[14:40:51] Malgorath: universa1, yeah I was wondering if I should do a <% if %> statement to make the labbled_tabular_form_for stuff
[14:41:12] universa1: Malgorath: no.
[14:41:23] universa1: Malgorath: your form is in a partial?
[14:41:35] Malgorath: yes, thats the entire partial
[14:41:55] Malgorath: oh wait, put the form_for in the edit.html.erb and new.html.erb?
[14:42:03] universa1: Malgorath: no!
[14:42:34] kitsuneyo: has joined #RubyOnRails
[14:43:07] universa1: Malgorath: render partial: "whatever_it_is", locals: {task_list: @task_list, submit_url: blub_path}; in your partial: form_for task_list, as: :task_list, url: submission_url
[14:43:29] triptec: has joined #RubyOnRails
[14:43:49] dnjo: has joined #RubyOnRails
[14:46:15] emachnic: has joined #RubyOnRails
[14:47:00] speakingcode: has joined #RubyOnRails
[14:47:11] sarink: has joined #RubyOnRails
[14:47:34] prithaj: has joined #RubyOnRails
[14:48:03] edwinvdgraaf: has joined #RubyOnRails
[14:48:40] akshat: has joined #RubyOnRails
[14:48:42] Malgorath: universa1, you da boss! Thanks
[14:50:03] dnjo: has joined #RubyOnRails
[14:50:49] alfiemax: will the after_save callback called if the object isn't saved to db? i.e @user.save , returns false due to validation failures
[14:51:54] jhack: has joined #RubyOnRails
[14:53:14] adre: has joined #RubyOnRails
[14:53:37] safetypin: has joined #RubyOnRails
[14:54:10] dnjo: has joined #RubyOnRails
[14:56:30] alfiemax: ok, that's what i thought, so i've a question
[14:56:55] alfiemax: i've a method that gets called in the after save callback
[14:57:13] jhack: has joined #RubyOnRails
[14:57:33] alfiemax: within that method it calls a sucker_punch job and passes in just one parameter, i.e self.id
[14:58:16] GodFather: has joined #RubyOnRails
[14:58:23] alfiemax: and within the job perform method, within a `ActiveRecord::Base.connection_pool.with_connection` block the first line is `user = User.find(user_id)`
[14:59:09] alfiemax: and i'm getting a ActiveRecord::RecordNotFound error
[14:59:21] alfiemax: any ideas o why this might be so
[14:59:46] alfiemax: this is the exact error message : Couldn't find User with 'id'=1535 [WHERE "users"."fake" = ?]
[14:59:50] ngw: has joined #RubyOnRails
[15:01:03] emachnic: has joined #RubyOnRails
[15:01:58] jhack: has joined #RubyOnRails
[15:03:03] sevenseacat: alfiemax: gisting the code and the full error will be usefil :)
[15:03:21] alfiemax: ok, np. 1 min
[15:03:57] artto: has joined #RubyOnRails
[15:04:00] aegis3121: has joined #RubyOnRails
[15:05:13] roamingdog: has joined #RubyOnRails
[15:08:18] alfiemax: sevenseacat, https://gist.github.com/alfie-max/9d738d0d44d1769ed418644d3c353a35
[15:09:52] sevenseacat: that's... not pretty code but anyway
[15:10:08] sevenseacat: the full error message with backtrace, please :)
[15:11:05] diegoaguilar: has joined #RubyOnRails
[15:13:07] dannyh: has joined #RubyOnRails
[15:13:27] dannyh: can someone help me figure out how to properly iterate over submitted form fields in a controller?
[15:13:50] dannyh: i have a form with similarly grouped text fields....they all have names that are similar to person[1], person[2], person[3]
[15:14:04] alfiemax: sevenseacat, updated
[15:14:07] dannyh: how do i iterate over each of these fields, extracting the number inside the brackets
[15:14:56] roamingdog: has joined #RubyOnRails
[15:15:35] alfiemax: Danny_, the submitted form fields are available as `params` in your controller. inspect its contents and you'd get an idea. btw i don't think you should be iterating over them
[15:16:08] dannyh: i have params[:person]
[15:16:13] sevenseacat: alfiemax: so your User is getting saved, because the job has an ID in it
[15:16:15] dannyh: im trying to figure out how to access the id inside
[15:16:25] sevenseacat: I think the proc condition might not be doing what you think its doing
[15:16:52] alfiemax: sevenseacat, would you please comment on how i can possibly make the code better?
[15:17:05] alfiemax: that's possible
[15:17:06] sevenseacat: 1) don't queue jobs in model callbacks
[15:17:23] sevenseacat: 2) don't refer to the Rails.env in a model
[15:17:38] sevenseacat: 3) don't use ActiveRecord connection pool in your jobs
[15:17:49] sevenseacat: 4) don't use default scopes
[15:17:53] doctorly: has joined #RubyOnRails
[15:17:56] sevenseacat: (though 4 is contentious)
[15:18:42] disgrntld: has joined #RubyOnRails
[15:18:43] alfiemax: could you also tell me the reasons for the first three
[15:19:02] sevenseacat: 3) is totally unnecessary
[15:19:21] fox_mulder_cp: sevenseacat: so, i have a class web_app with nested resources such as client and app_server. how to serialize all og them to json, as example
[15:19:51] sevenseacat: 1) is horrible coupling that will slow down all your unrelated code (like tests) and give you no separation of concerns
[15:19:55] sevenseacat: 2) is just... why would you do that
[15:20:21] fox_mulder_cp: or call my delayed_job as Delayed::Job.enqueue CreateContainerJob.new web_app, app_server, client?
[15:21:56] alfiemax: 2) only reason was that because the job creates/updates a user in a third party service, so i don't want that to be run
[15:22:27] alfiemax: but given that i don't queue jobs in model callbacks, 2 gets fixed
[15:22:34] sevenseacat: does your app not rely on it?
[15:22:49] alfiemax: yeah, but in development mode i dont want it
[15:23:03] sevenseacat: if it relies on it, it will break without it
[15:23:06] fox_mulder_cp: alfiemax: but if i want check for my model status ('wait_job', 'process_job', 'done_job')?
[15:23:10] alfiemax: my app is for some sales purposes, so in adds users to a mailing list
[15:23:22] yellow5: has joined #RubyOnRails
[15:23:50] alfiemax: that's why i don't want it to add any users created in dev to get added in the mailing list
[15:24:15] sevenseacat: thats why you would typically have a separate list for test purposes
[15:24:38] fox_mulder_cp: test database, fabric for testing users, etc
[15:25:15] alfiemax: yeah i did, but my client said they send out a weekly email to all users in all lists
[15:25:23] alfiemax: thats when i did this
[15:25:48] fox_mulder_cp: and why test dev users mixed with real production users?
[15:26:50] alfiemax: fox_mulder_cp, test??
[15:27:07] alfiemax: was the question aimed at me?
[15:27:58] Oliphaun_: has joined #RubyOnRails
[15:28:17] alfiemax: sevenseacat, that being said, where else would i call the method to queue job?/
[15:28:42] sevenseacat: in the controller, or in a service object, or whatever neatly encapsulate that call in the specific place you want it called
[15:28:59] sevenseacat: because I really don't think you want it called all the time
[15:29:11] alfiemax: actually i do
[15:29:19] sevenseacat: you really don't
[15:29:30] pawnbox: has joined #RubyOnRails
[15:29:51] alfiemax: i do :) i really get what you are thinking
[15:30:03] rueben: has joined #RubyOnRails
[15:30:47] alfiemax: in the app users are saved just twice
[15:30:53] alfiemax: when created
[15:31:05] alfiemax: and later when updated, just once
[15:31:52] alfiemax: this is a small app for sales campaigning
[15:34:39] artto: has joined #RubyOnRails
[15:36:51] alfiemax: as for 3) it was there in the docs
[15:36:53] urbanmonk: has joined #RubyOnRails
[15:36:54] alfiemax: ref : https://github.com/brandonhilkert/sucker_punch#activerecord-connection-pool-connections
[15:40:04] jtong: has joined #RubyOnRails
[15:40:27] jowiar: has joined #RubyOnRails
[15:43:57] tbuehlmann: "[…], which ensures the connection is returned back to the pool when completed." - that's wrong btw. the method will only do that if the connection retrieved was fresh
[15:44:06] tbuehlmann: clear_active_connections! will, however, do that
[15:46:58] dionysus69: has joined #RubyOnRails
[15:51:13] rubyonrails372: has joined #RubyOnRails
[15:51:17] aegis3121: has joined #RubyOnRails
[15:51:49] rubyonrails372: is anyone here familiar with Openshift's free tier?
[15:52:25] rubyonrails372: the free tier offers 1GB storage per app. i'm just wanting to know if uploaded files will get deleted after a period of time like in heroku
[15:52:38] davidw: has joined #RubyOnRails
[15:55:03] JamesGames: has joined #RubyOnRails
[15:55:45] TheMonster: rubyonrails372: as far as I know, Heroku doesn't delete the files after some time... It's just that it doesn't have a permanent storage option so you don't have a store
[15:55:51] TheMonster: Openshift has one
[15:56:44] rubyonrails372: @TheMonster neat! thanks
[15:56:44] TheMonster: just make sure to save your files and retrieve them from that permanent storage directory
[15:57:04] alfiemax: TheMonster, heroku does delete the files after sometime
[15:57:22] agent_white: has joined #RubyOnRails
[15:57:31] flashpoint9: has joined #RubyOnRails
[15:57:45] TheMonster: I think you mean when your dyno goes to sleep? that's because a new instance of the app is launched
[15:58:12] JamesGames: hello adam12, me again, not sure where to put the current_user helper. Had a look online and found: def current_user
[15:58:12] JamesGames: @current_user ||= session[:current_user_id] && User.find_by_id(session[:current_user_id])
[15:58:12] JamesGames: # Use find_by_id to get nil instead of an error if user doesn't exist
[15:58:12] JamesGames: helper_method :current_user #make this method available in views
[15:58:29] pawnbox: has joined #RubyOnRails
[15:58:57] ldnunes: has joined #RubyOnRails
[15:59:02] alfiemax: TheMonster, yes exactly
[15:59:09] alfiemax: and not only when it sleeps
[15:59:16] TheMonster: when you push too
[15:59:22] TheMonster: I wouldn't call that "delete files"
[15:59:25] TheMonster: they just don't keep them
[15:59:29] JamesGames: I want to display both the room/show/html.erb and user/show.html.erb using PARTIALS
[15:59:38] alfiemax: heroku dynos get restarted also
[15:59:38] rubyonrails372: @TheMonster so images uploaded to an openshift free account will stay even after the application becomes idle (after 24 hrs of inactivity)?
[15:59:39] macsteps: has joined #RubyOnRails
[15:59:59] alfiemax: and in effect not keeping files == deleting files
[16:00:05] alfiemax: atleast to an end user
[16:00:14] TheMonster: rubyonrails372: not if you put them in the public directory for example... There's a specific directory that keeps the files
[16:00:38] TheMonster: you need to find out its name... I can't remember it... It's present in an ENV variable
[16:01:01] JamesGames: ok peeps, anyone know about setting a current user from session, or how to combine partials
[16:02:35] JamesGames: I have the code, but is it right? where should I put it?
[16:03:33] diegoaguilar: has joined #RubyOnRails
[16:03:43] JamesGames: even give me keywords? I keep getting rubbish when I check stack overflow
[16:05:10] Jenzo: has joined #RubyOnRails
[16:07:07] macsteps: has joined #RubyOnRails
[16:07:16] TheShaun: has joined #RubyOnRails
[16:07:38] pawnbox: has joined #RubyOnRails
[16:07:53] JamesGames: i will post the link once the game is done - free game?
[16:08:17] kitsuneyo: hi JamesGames
[16:08:35] zave: has joined #RubyOnRails
[16:08:38] kitsuneyo: are you a total rails beginner?
[16:08:51] JamesGames: no> i get confused though
[16:09:04] jtong_: has joined #RubyOnRails
[16:09:05] JamesGames: im used to unity
[16:09:28] kitsuneyo: when searching google for stack overflow answers, i find it best to set google search tools to within past year. many rails answers are old and outdated.
[16:10:34] JamesGames: i have two views< one is room/show.html.erb
[16:10:42] kitsuneyo: i don't know much about unity but i guess it's pretty different...
[16:10:51] jtong_: has joined #RubyOnRails
[16:11:02] JamesGames: and the other is user/show.html.erb
[16:11:21] kitsuneyo: so they belong to different controllers
[16:11:31] JamesGames: i wanna show the room from a current user id
[16:11:38] JamesGames: yes two controllers
[16:11:58] JamesGames: i guess i wanna combine partials
[16:12:33] JamesGames: but i can`t even get the right user.room
[16:12:45] kitsuneyo: i think you
[16:12:53] kitsuneyo: i think you're coming at it the wrong way
[16:13:58] kitsuneyo: you just need to set an instance variable in your rooms_controller's show action, something like @user_room = current_user.room
[16:14:01] [Butch]: has joined #RubyOnRails
[16:14:01] JamesGames: the room should be set with a user>room_name variable adn the room attributes displayed
[16:14:29] context: "the right user.room" ?
[16:14:43] context: you should start there...
[16:14:44] kitsuneyo: then you can use @user_room in your rooms/show view to display data from the current_user's room
[16:15:14] JamesGames: @room = Room.find_by_name("The Marsh")
[16:15:14] JamesGames: render "show"
[16:15:34] JamesGames: and I try to set it to current user
[16:15:47] TheShaun: has joined #RubyOnRails
[16:15:49] context: looks like the marsh will ALWAYS be the current room
[16:15:53] [Butch]: has joined #RubyOnRails
[16:16:20] JamesGames: yes. i have tried to change it to the user variable with no success
[16:16:41] JamesGames: i keep getting nil_class
[16:16:55] kitsuneyo: JamesGames, have you defined the relationship between rooms and users in their respective models?
[16:17:14] kitsuneyo: and have you got a current_user method?
[16:17:39] kitsuneyo: once you do that, you can simply do @room = current_user.room
[16:18:04] JamesGames: so. how do i set up the model?
[16:18:40] JamesGames: I had a current_user method
[16:18:50] JamesGames: def current_user()
[16:18:50] JamesGames: return Users.find(1)
[16:19:04] kitsuneyo: it would be a bit silly to try and explain something so fundamental over irc. i suggest you do some more learning, i'd start with railstutorial.org
[16:19:13] pawnbox: has joined #RubyOnRails
[16:19:33] JamesGames: I have read that tutorial
[16:19:45] kitsuneyo: that will always return the user with id '1'. what if the user with id '2' signs in?
[16:20:06] kitsuneyo: did you build the app?
[16:20:10] JamesGames: that was just to test the function> it failed
[16:20:22] JamesGames: yes i built the app
[16:20:51] JamesGames: up to chapter ten
[16:21:18] pawnbox: has joined #RubyOnRails
[16:22:00] JamesGames: how (and where) would i make the current user fn
[16:22:48] JamesGames: i put it in the application helper
[16:22:59] kitsuneyo: JamesGames: https://www.railstutorial.org/book/log_in_log_out
[16:23:17] kitsuneyo: i don't know what your user model looks like though
[16:23:34] kitsuneyo: it will depend partly on that
[16:24:18] TheShaun: has joined #RubyOnRails
[16:24:23] JamesGames: Alrite. I dont understand
[16:24:43] centrx: has joined #RubyOnRails
[16:25:13] kitsuneyo: JamesGames, just use the Devise gem for your user model and current_user will be there for you to use
[16:25:31] kitsuneyo: that's what everyone else does, pretty much
[16:25:50] centrx: has joined #RubyOnRails
[16:25:54] JamesGames: Lets just focus< how can i get the current user from the session id< and put it into the room view?
[16:26:34] JamesGames: once i have that working i can merge partials
[16:26:44] sarink: has joined #RubyOnRails
[16:26:49] kitsuneyo: i don't know because i know nothing about your user model or how you're handling sessions
[16:27:15] JamesGames: what files i send u?
[16:27:35] kitsuneyo: and there is no such thing as merging partials, it's not what you need to do
[16:27:48] kitsuneyo: nothing, go read some more basics
[16:27:58] rubyonrails372: does anyone know how to deploy to Openshift? i've read a few articles and i'm still confused
[16:28:43] centrx: has joined #RubyOnRails
[16:31:09] saggymac: has joined #RubyOnRails
[16:31:27] flashpoint9: has joined #RubyOnRails
[16:31:45] Ionut`: has joined #RubyOnRails
[16:32:25] JamesGames: kitsuneyo[afk] : what is wrong with
[16:32:34] JamesGames: @room = Room.find_by_name(user.room_name)
[16:33:59] kitsuneyo[afk]: i don't know, what is 'user'? is it a variable with a value?
[16:34:10] JamesGames: im getting undefined method nilclass
[16:34:29] JamesGames: sorry i meant current_user
[16:34:46] JamesGames: it is the current_user from the helper fn
[16:34:55] adam12: JamesGames: Move current_user method from helper to ApplicationController
[16:35:02] adam12: and then put `helper_method :current_user` below it.
[16:35:25] JamesGames: adam! good to see u man!
[16:36:37] diego1: has joined #RubyOnRails
[16:37:15] adam12: diegoviola: o/
[16:37:19] JamesGames: right. i have it in the controller. I gist it up ?
[16:37:29] adam12: JamesGames: Does your code work now?
[16:38:09] alfiemax: has joined #RubyOnRails
[16:38:21] sarink: has joined #RubyOnRails
[16:38:31] JamesGames: no : undefined method `room_name' for nil:NilClass
[16:38:43] adam12: JamesGames: Make a gist with the `current_user` method.
[16:40:30] JamesGames: https://gist.github.com/anonymous/72a4c9bad5f307b798c19a4a9094cd84
[16:41:13] adam12: JamesGames: Looks right. Gist your login controller
[16:41:40] arunpyasi: has joined #RubyOnRails
[16:42:58] JamesGames: https://gist.github.com/anonymous/4b060ac971f616ef024c6dd95ccecf32
[16:43:07] speakingcode: has joined #RubyOnRails
[16:43:27] adam12: Wrong controller. SessionsController maybe?
[16:43:40] flashpoint9: has joined #RubyOnRails
[16:43:44] manfrin: has joined #RubyOnRails
[16:43:48] TheShaun: has joined #RubyOnRails
[16:44:14] adam12: JamesGames: I'll bbiaf.
[16:44:33] JamesGames: https://gist.github.com/anonymous/6c866cc05b6199d929e1d96a4007ed8a
[16:44:38] replay: has joined #RubyOnRails
[16:45:42] JamesGames: kitsuneyo[afk] - thanks 4 tha help. I will get this
[16:45:56] pawnbox: has joined #RubyOnRails
[16:45:56] JamesGames: it seems so simple
[16:46:02] kitsuneyo[afk]: good luck, i'm a beginner as well
[16:46:19] pawnbox: has joined #RubyOnRails
[16:47:06] JamesGames: yes. why can't I just change a variable w a button? views controllers and helpers that actually make it 6 steps to change on value
[16:48:37] JamesGames: kitsuneyo[afk] : what are u making?
[16:48:37] kitsuneyo[afk]: depends how you organise your code...
[16:50:37] JamesGames: i will post the game link here. Y'all can play 4 free! --IF-- i get it working
[16:51:38] hahuang61: has joined #RubyOnRails
[16:52:06] centrx: has joined #RubyOnRails
[16:52:44] kitsuneyo: has joined #RubyOnRails
[16:53:01] kitsuneyo: JamesGames, a kind of database app
[16:53:35] JamesGames: cool. I need testers for mi game, when it's ready...
[16:53:46] kitsuneyo: does anyone else find that Capybara integration tests aren't reliable? Sometimes they all pass, other times the same tests refuse to find css selectors?
[16:54:12] kitsuneyo: JamesGames, what are you making with rails?
[16:54:35] JamesGames: It's a fantastic text based adventure
[16:54:51] jhack: kitsuneyo: maybe your tests arent written correctly ?
[16:54:51] kitsuneyo: really, why not just use rpgmaker?
[16:54:55] jhass: kitsuneyo: well selenium & poltergeist/phantomjs rather than capybara itself. It's hard to write reliable tests though phantomjs seems to make it tad easier. Faster at least
[16:55:11] kitsuneyo: jhack, i'm using selenium web driver
[16:55:16] JamesGames: I have to use rails, it's 4 college
[16:55:23] aegis3121: has joined #RubyOnRails
[16:55:52] JamesGames: adam? u round?
[16:55:56] emachnic: has joined #RubyOnRails
[16:55:58] kitsuneyo: sorry meant jhass, confusingly similar names
[16:55:59] sarink: has joined #RubyOnRails
[16:56:13] xall: has joined #RubyOnRails
[16:56:35] kitsuneyo: i think my tests are correct, there's nothing that complicated in them
[16:57:41] emachnic: has joined #RubyOnRails
[16:58:06] emachnic: has joined #RubyOnRails
[16:58:45] emachnic: has joined #RubyOnRails
[16:59:46] emachnic: has joined #RubyOnRails
[16:59:54] adam12: JamesGames: What does the method `log_in` look like?
[17:00:59] JamesGames: i think it's the one in session controller, the line is : if user.activated?
[17:01:26] JamesGames: is that wrong
[17:01:29] adam12: That's a method call. log_in is a method, but we need to know what it looks like
[17:01:39] adam12: It should be setting a value in session
[17:02:10] haaj: has joined #RubyOnRails
[17:02:32] JamesGames: so, session/new.html.erb
[17:02:49] adam12: Somewhere you have `def log_in`. Let's see that.
[17:05:02] JamesGames: # Logs in the given user.
[17:05:02] JamesGames: def log_in(user)
[17:05:02] JamesGames: session[:user_id] = user.id
[17:05:11] JamesGames: it was in session helper
[17:05:28] adam12: Now, is session[:user_id] here the same as the session[] in current_user?
[17:05:30] adam12: Look closely.
[17:06:16] adam12: I betcha the symbol is different.
[17:06:36] cnk: has joined #RubyOnRails
[17:06:56] adam12: Make them the same.
[17:06:57] JamesGames: i change it right?
[17:07:07] JamesGames: which one i change
[17:07:12] adam12: Doesn't matter which one you choose, but make them the same. I prefer `:user_id`
[17:07:22] DoctorMonocular: has joined #RubyOnRails
[17:07:35] adam12: And make sure in current_user you update *both*
[17:07:58] adam12: Then refresh your page.
[17:09:57] JamesGames: ok. I got : undefined local variable or method `user' for #<RoomsController:0x000000039bc550>
[17:10:07] adam12: How about changing that to `current_user`
[17:10:42] jtong: has joined #RubyOnRails
[17:11:19] jtong: has joined #RubyOnRails
[17:11:22] triptec: has joined #RubyOnRails
[17:12:01] JamesGames: i dunno. it says : def current_user
[17:12:02] JamesGames: session[:user_id] = user.id
[17:12:14] adam12: You want to change `user` to `current_user`
[17:12:27] adam12: I would put `current_user` back the way it was
[17:12:39] jhass: inb4 endless recursion
[17:12:41] adam12: The change you want to make is elsewhere - it's in the error message you just posted.
[17:13:42] jhass: adam12: might be faster if you just give them the done project ;)
[17:14:05] adam12: jhass: :)
[17:14:18] jtong_: has joined #RubyOnRails
[17:14:21] jhass: I estimate the same effect anyway
[17:14:46] JamesGames: I think i got it guys
[17:15:03] weaksauce: has joined #RubyOnRails
[17:15:47] jtong_: has joined #RubyOnRails
[17:17:01] mwlang: has joined #RubyOnRails
[17:17:56] `0ctayn: hi, i am getting this error when making a soap request: "SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed". i am using rails 2.3, ruby 1.8.7-head, the soap request is with savon 2.3.0. i was not able to find a solution online. how can i resolve the error?
[17:18:00] agit0: has joined #RubyOnRails
[17:18:15] adam12: `0ctayn: That's an ancient ruby version.
[17:18:50] adam12: I wonder if it has to do with the OpenSSL version you're using and the recent SSL bugs.
[17:19:20] adam12: Can you share the host your connecting to?
[17:19:50] JamesGames: o no. undefined method `room_name' for nil:NilClass
[17:20:10] speakingcode: has joined #RubyOnRails
[17:20:14] adam12: `0ctayn: Tell us?
[17:20:29] mwlang: I don’t quite get setting time zones in Rails…I set this just fine: config.active_record.default_timezone = :local but when I set config.time_zone, I can’t seem to just use the timezone name. That is, from rails console: Time.now.getlocal.zone => "CEST”, but when I add that to the application config like so: config.time_zone = "CEST" I get an error: “activesupport-4.1.13/lib/active_support/core_ext/time/zones.rb:72:in `rescu
[17:20:30] mwlang: find_zone!': Invalid Timezone: CEST (ArgumentError)”
[17:20:35] `0ctayn: wouldn't matter.. it's just a host im whitelisted to
[17:20:52] Pazician: has joined #RubyOnRails
[17:20:52] Pazician: has joined #RubyOnRails
[17:21:00] adam12: `0ctayn: Ah. OK.
[17:21:08] adam12: What platform is this on?
[17:21:50] adam12: You might need an updated ca bundle.
[17:21:53] adam12: What release of centos?
[17:22:44] adam12: Hmm. Maybe not - that's super recent.
[17:22:47] mwlang: A quick google on the setting shows examples like: “config.time_zone = 'Central Time (US & Canada)’” so apparently there’s a long name for the timezone somewhere I need to be using, but where’s this list?
[17:23:04] adam12: mwlang: I think there is a rake task.
[17:23:10] `0ctayn: i ran the command "yum update" as well so everythings up to date
[17:23:20] adam12: mwlang: `rake -T` and look for something about time zones.
[17:23:30] jmignault: has joined #RubyOnRails
[17:23:53] JamesGames: wait. this is activated once I login? So how do I get to the rooms current from login?
[17:24:28] adam12: JamesGames: You mean after you login?
[17:24:40] mwlang: adam12: ah-ha! thanks.
[17:24:52] context: you are asking us how your app works ?
[17:25:23] JamesGames: yes. It woulden't work if i went straight to /rooms/current
[17:26:16] adam12: JamesGames: You need two things. One, after someone logs in, redirect them to current_room_path. Two, In your room controller, you need to make sure they are logged in and redirect them to the login page if not.
[17:27:08] mwlang: rake time:zones:all is mostly city names, although the US timezones has entries I would’ve expected for “Eastern Time (US & Canada)” as well as city names.
[17:27:10] JamesGames: wait I can use redirect_to
[17:27:51] mwlang: so does that mean I set time zones by picking nearest city? That just seems weird to me.
[17:28:11] adam12: `0ctayn: There is a way to get another ca bundle - perhaps a more up to date one. I am not familiar with savon but you might be able to get the new ca bundle and tell savon (or Net::HTTP) to use it instead.
[17:28:14] akshat: has joined #RubyOnRails
[17:28:25] adam12: `0ctayn: That's presuming it's because of the bundle being out of date, not that your cert chain on the remote host is actually busted.
[17:28:31] djbkd: has joined #RubyOnRails
[17:28:49] adam12: mwlang: I think ActiveSupport does some mapping of city names to proper timezones. Dont' quote me on that.
[17:29:04] `0ctayn: hmm ok i will try
[17:29:10] djbkd: has joined #RubyOnRails
[17:29:21] adam12: `0ctayn: Some context - https://github.com/intridea/omniauth/issues/404#issuecomment-1715745
[17:29:24] jmignault: has joined #RubyOnRails
[17:29:37] context: `0ctayn: in your savon client do ssl_verify_mode :none
[17:29:46] context: `0ctayn: id assume its a self signed certificate
[17:30:11] context: do you know its signed by a proper CA ?
[17:30:36] jokke: why doesn't puma respect RAILS_ENV?
[17:31:01] jokke: it's annoying
[17:31:26] `0ctayn: ssl_verify_mode :none fixed the issue
[17:31:47] adam12: `0ctayn: If you don't care for verifying cert, it's the easiest fix
[17:31:57] adam12: But that has to be a calculated risk
[17:32:27] adam12: bbiaf. new baby is fussing
[17:32:40] `0ctayn: yes. i need to figure out how to resolve the issue with the cert but that is a technical debt
[17:33:02] mwlang: just on a hunch, I tried “CET” instead of “CEST” and it’s working.
[17:33:30] mwlang: but CET doesn’t show up in the list generated by rake time:zones:all
[17:34:32] mwlang: so there’s some disconnect there, but at least a standard timezone abbreviation works! I got the right abbreviation from browsing to here: http://www.timeanddate.com/time/zones/cet
[17:34:38] SteenJobs: has joined #RubyOnRails
[17:34:53] JamesGames: https://gist.github.com/anonymous/ebbcf3dde18b2af4c3187e38bd0800f4
[17:35:02] JamesGames: adam - that any use?
[17:35:07] jhack: has joined #RubyOnRails
[17:37:51] arBmind: has joined #RubyOnRails
[17:38:24] JamesGames: i don't use devise , so I dunno
[17:38:38] rogue_koder: has joined #RubyOnRails
[17:38:46] whathappens: has joined #RubyOnRails
[17:39:13] adam12: JamesGames: No. You're not using devise so that won't help
[17:39:41] adam12: JamesGames: The signin happens in SessionsController, create action. You need a `redirect_to current_room_path` in there somewhere. I bet you can figure out where.
[17:39:50] JamesGames: ok can i just redirect_to /rooms/current ?
[17:40:39] jhass: `0ctayn: just to make clear you understood what kind of solution you applied. You will not notice if your request is intercepted by a MITM attack
[17:41:05] jhass: it's effectively the same than using no TLS at all (since on that ancient stuff we can't assume any other benefits like PFS)
[17:41:37] JamesGames: its redirecting anyways.: if user.activated?
[17:41:37] JamesGames: params[:session][:remember_me] == '1' ? remember(user) : forget(user)
[17:41:37] JamesGames: redirect_back_or user
[17:41:37] oystersauce8: has joined #RubyOnRails
[17:41:47] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[17:42:20] JamesGames: can i change it to redirect_back or redirect_to_current_room_path
[17:42:28] siaw23: has joined #RubyOnRails
[17:42:31] adam12: JamesGames: Temporarily, I'd change the redirect to what we said.
[17:42:41] helpa: Please do not paste code to the channel. It makes it hard to read and respond, especially if everyone does it. Use https://gist.github.com to share your code and errors. Thank you!
[17:42:49] adam12: JamesGames: You can change it to whatever you want but you need to write the to support that.
[17:43:55] adam12: Wow. Accidentally a word apparently.
[17:44:28] JamesGames: has joined #RubyOnRails
[17:46:23] mrbubbles: has joined #RubyOnRails
[17:46:52] polishdub: has joined #RubyOnRails
[17:48:12] macsteps: has joined #RubyOnRails
[17:49:41] yellow5: has joined #RubyOnRails
[17:51:08] ElFerna: has joined #RubyOnRails
[17:51:38] jgt: has joined #RubyOnRails
[17:53:44] hahuang61: has joined #RubyOnRails
[17:55:38] peterppp: has joined #RubyOnRails
[17:56:15] peterppp: I'm looking for an open source Rails project whose source code I could peruse to learn from, does anyone have a recommendation?
[17:58:56] jenrzzz: has joined #RubyOnRails
[17:59:56] peterppp: alfiemax, thanks, looking at it right now
[18:01:25] alfiemax: but if you are a beginner and trying to just learn rails, i'd advice you to start with trying out writing simple apps
[18:02:10] alfiemax: looking at source of a huge project like gitlabhq wouldn't do much good at this point, i think.. its just my opinion
[18:02:39] haaj: has joined #RubyOnRails
[18:03:15] JamesGames: adam, Im just trying to verify this on heroku
[18:05:54] adac: has joined #RubyOnRails
[18:07:27] roamingdog: would love some help unchecking a checkbox with capybara, https://gist.github.com/chrislerum/0d7b2cd288d58e2b20e09919600e92a2
[18:07:51] JamieD: has joined #RubyOnRails
[18:08:30] pontiki: has joined #RubyOnRails
[18:12:08] gingray: has joined #RubyOnRails
[18:12:32] roamingd_: has joined #RubyOnRails
[18:12:41] conta: has joined #RubyOnRails
[18:12:46] dnjo: has joined #RubyOnRails
[18:13:13] AmiMoench: has joined #RubyOnRails
[18:15:41] SteenJobs: has joined #RubyOnRails
[18:15:59] Leepoff: has joined #RubyOnRails
[18:17:13] neoice: has joined #RubyOnRails
[18:19:12] JamesGames: heroku seems not to want to verify users
[18:22:11] jowiar: has joined #RubyOnRails
[18:22:28] Oliphaunte: has joined #RubyOnRails
[18:24:54] k3rn31: has joined #RubyOnRails
[18:25:10] Ruby0nRheyls: has joined #RubyOnRails
[18:27:22] mostlybadfly: has joined #RubyOnRails
[18:29:35] xall: has joined #RubyOnRails
[18:33:28] macsteps: has joined #RubyOnRails
[18:35:34] jenrzzz: has joined #RubyOnRails
[18:35:34] jenrzzz: has joined #RubyOnRails
[18:37:30] Ruby0nRheyls: [20:27] <Ruby0nRheyls> hi [20:27] == Moosashi [~sk@] has quit [Quit: Moosashi] [20:28] <Ruby0nRheyls> I have a rails app and I'd want to deploy it on a free server but I have tried some of them a no solution works. [20:29] <Ruby0nRheyls> When I tried heroku, I got an error even though the deployment was said to be achieved. [20:30] <Ruby0nRheyls> Could someone help me to make it please? [20:31] <Ruby0nRheyls> Th
[18:37:43] Ruby0nRheyls: looking for doesn't exist. You may have mistyped the address or the page may have moved." [20:32] <Ruby0nRheyls> No, the error was: " Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details." [20:33] <Ruby0nRheyls> I have tried to make it work on several servers for days, and try the ideas on
[18:37:46] k3rn31: has joined #RubyOnRails
[18:38:05] Ruby0nRheyls: I would be strongly thankful if somebody could help me, for instance with TeamViewer!
[18:39:06] omz: has joined #RubyOnRails
[18:39:17] JamesGames: I don't know. Is that normal? Adam, u there?
[18:39:52] dalpo: has joined #RubyOnRails
[18:40:05] Dimik: has joined #RubyOnRails
[18:40:23] Ruby0nRheyls: JamesGames: could you help me on Teamviewer?
[18:40:43] siaw23: has joined #RubyOnRails
[18:41:26] JamesGames: probly not. Im kina messed up w mi own stoopid app
[18:41:57] JamesGames: adam 12 is clever though. Maybe he can?
[18:42:33] JamesGames: whats the problem anyway
[18:43:04] sarink: has joined #RubyOnRails
[18:43:34] SteenJobs: if i wrote a stripe service and need to write rescues for each of the methods, but the exceptions being caught are the same for each methods, is there a way to only write the rescue statements once?
[18:43:58] JamesGames: Heroku has turned on me and i can't login to check if the redirection works
[18:44:24] doctorly: has left #RubyOnRails: ()
[18:45:28] aegis3121: has joined #RubyOnRails
[18:45:30] rueben: has joined #RubyOnRails
[18:46:38] shortCircuit__: has joined #RubyOnRails
[18:47:31] shortCircuit__: hi.. I need some help with authenticating with captcha .. I need some ideas ... is someone willing to discuss
[18:52:02] JamesGames: undefined method `room_name' for nil:NilClass, the thing redirects but the current user is not returning a value
[18:52:26] JamesGames: the url is https://mytestingspace-computron59.c9users.io/rooms/current.1
[18:54:29] hahuang61: has joined #RubyOnRails
[18:55:35] JamesGames: im close to getting this, does anyone know about redirection to an active record path
[18:57:46] JamesGames: i have : redirect_to current_room_path user
[18:57:48] pLaToOn: has joined #RubyOnRails
[18:58:30] JamesGames: and I need to go to current_user room_name's path
[18:59:28] bobbobbins: has joined #RubyOnRails
[18:59:33] replay: has joined #RubyOnRails
[18:59:35] JamesGames: stroke your beards people. hmmmm!
[18:59:43] shinnya: has joined #RubyOnRails
[19:00:28] bobbobbins: hey, anyone here use pkgr at all? I'm trying to bundle up a rails application, but I keep getting errors about buildpacks not existing
[19:00:49] SteenJobs: has joined #RubyOnRails
[19:01:16] xall: has joined #RubyOnRails
[19:02:09] goodroot: has joined #RubyOnRails
[19:02:37] Ergo: has joined #RubyOnRails
[19:02:44] goodroot: Anyone have experience with .slim templates? I have a text input box that, when clicked into, creates trailing white-space. Want to banish this whitespace into the sun.
[19:03:05] jowiar: has joined #RubyOnRails
[19:03:37] JamesGames: will this work? --- redirect_to /rooms/current_user.room_name user
[19:03:42] haaj: has joined #RubyOnRails
[19:04:32] JamesGames: ok. what will
[19:05:01] cnk: but something like room_path(current_user.room_name) should
[19:05:14] disgrntld: has joined #RubyOnRails
[19:06:29] pawnbox: has joined #RubyOnRails
[19:08:34] bobbobbins: has left #RubyOnRails: ()
[19:11:05] JamesGames: getting a syntax error. how should I be passing the Current_user.room_name var?
[19:11:59] Oliphaunte: has joined #RubyOnRails
[19:12:53] JamesGames: I have my routes.rb:
[19:12:53] JamesGames: get "/rooms/current" => "rooms#current", as: :current_room
[19:12:53] JamesGames: get "/rooms/change/:name" => "rooms#change", as: :change_room
[19:14:31] cnk: So it doesn't look to me like you have a route that maps to /rooms/room_name
[19:14:53] cnk: I had assumed you had a route already
[19:15:15] cnk: make a route, then use corresponding syntax to redirect to it
[19:16:00] cnk: JamesGames: have you worked through any Rails books or tutorials?
[19:17:16] JamesGames: yes 2 . but this is my first app and Im not doing well
[19:18:04] cnk: Personally I would use a generated scaffold for some stuff and then modify that
[19:18:10] JamesGames: get "/rooms/user_room" => "rooms#user"
[19:18:12] cnk: for example, the rooms model
[19:18:18] jenrzzz: has joined #RubyOnRails
[19:18:18] jenrzzz: has joined #RubyOnRails
[19:18:55] cnk: if you want to define your route that way, add an 'as' clause so you can refer to it in your controller more easily
[19:18:56] conta: can I generate has_many through migration?
[19:19:02] JamesGames: how do I pass the current_user to a route?
[19:19:22] cnk: for example as: 'users_room', then you can use users_room_path as the helper
[19:19:29] cnk: you shouldn't
[19:19:29] omz: undefined method `room_name' for nil:NilClass => so your object is nil
[19:19:45] cnk: current_user should not be in the URL because you don't want people messing with that parameter
[19:20:04] cnk: also, your route doesn't take a parameter, so you can't pass one and still match
[19:20:12] omz: where is your code, james?
[19:20:30] dnjo: has joined #RubyOnRails
[19:21:32] JamesGames: i make a big gist now
[19:22:34] tape88: has joined #RubyOnRails
[19:24:18] JamesGames: https://gist.github.com/anonymous/7540cc07eb6b17ac0d437915877705fa
[19:24:30] pLaToOn: has joined #RubyOnRails
[19:25:18] JamesGames: why wont redirect_to :current_room user work?
[19:25:20] djbkd: has joined #RubyOnRails
[19:26:31] dnjo_: has joined #RubyOnRails
[19:27:05] cnk: the current_room route doesn't take a parameter
[19:27:37] cnk: when you try it, what url ends up in the browser?
[19:27:47] roamingdog: has joined #RubyOnRails
[19:27:49] dalpo: has joined #RubyOnRails
[19:27:54] cnk: is it /rooms/current?user=23 ?
[19:28:28] rubyonrailed: I'm trying to build an association from my parent controller, but am having trouble passing the association hash. It is not building or creating the assocation. Does anyone see anything wrong? https://gist.github.com/JasonMannon/6e498c15b65550ae38c3afc56522e4d4
[19:28:54] JamesGames: atm it is syntax error , but before it was https://mytestingspace-computron59.c9users.io/rooms/current.1
[19:29:14] Leepoff: has joined #RubyOnRails
[19:29:27] JamesGames: clearly wrong
[19:29:44] siaw23: has joined #RubyOnRails
[19:30:19] cnk: run 'rake routes' and study the output. That shows you the routes you have - what their url patterns are and what the helpers (if any) will be called
[19:31:28] cnk: But looking at your code, all you need is redirect_to current_room_path
[19:31:47] JamesGames: here is the gist https://gist.github.com/anonymous/c2ee02ee6f37804eb04b205c6159c945
[19:31:53] sandelius: has joined #RubyOnRails
[19:32:05] JamesGames: really? hang on i check
[19:32:13] cnk: I am a little iffy about your current_user stuff
[19:32:18] cnk: you may need @current_user
[19:32:33] cnk: add some 'puts' statements and tail your development.log
[19:32:46] cnk: what authentication framework are you using?
[19:33:15] shortCircuit__: there was something similar to even machine in rails . I can't rememeber .. maybe it started with A . it was in the spree gem I think .. or maybe I am wrong .. I just can't remember
[19:34:14] JamesGames: the url is the one mentioned , and i am getting : undefined method `room_name' for nil:NilClass
[19:35:01] JamesGames: cnk: not sure i used guardfile, not sure how to fix current user
[19:35:10] macsteps: has joined #RubyOnRails
[19:35:19] cnk: rubyonrailed: which address doesn't build? neither?
[19:35:28] rubyonrailed: cnk: Yup, none
[19:35:32] cnk: the build_pickup_address loooks better t ome
[19:35:50] JamesGames: the welcome page, the login page, then that weird url
[19:35:54] cnk: wellmmmm
[19:36:11] cnk: I guess first, check your params are getting through order_params
[19:36:29] rubyonrailed: cnk: They aren't. For some reason those aren't showing
[19:36:47] cnk: JamesGames: right, you don't have current user
[19:36:57] cnk: try @current_user.room_name
[19:36:58] omz: undefined method `room_name' for nil:NilClass ==> so the current_user is nil
[19:37:14] cnk: AND what are you using for authentication? Devise? or something else?
[19:37:52] sarink: has joined #RubyOnRails
[19:37:54] JamesGames: nah just pure ruby
[19:38:00] JamesGames: @current_user ||= session[:current_user_id] && User.find_by_id(session[:current_user_id])
[19:38:09] cnk: IMO you are not ready to build your own auth
[19:38:18] JamesGames: is done already
[19:38:34] cnk: I am not convinced it is working
[19:38:35] JamesGames: just plodded along with M Hartl's book
[19:38:47] omz: try p current_user
[19:38:51] cnk: but whatever, try @current_user.room_name in your current_room controller
[19:39:29] cnk: rubyonrailed: can you include the request params in your gist
[19:39:31] cnk: from the log
[19:39:37] omz: without @ cnk, just current_user
[19:39:44] JamesGames: cnk: i dont have one, maybe room_controller?
[19:40:18] rubyonrailed: cnk: updated https://gist.github.com/JasonMannon/6e498c15b65550ae38c3afc56522e4d4
[19:40:18] JamesGames: @room = Room.find_by_name(current_user.room_name)
[19:40:45] SteenJobs: anyone ever have trouble setting html options for date_select?
[19:41:05] cnk: omz: his ApplicationController sets @current_user
[19:41:17] cnk: but has a method name current_user
[19:41:23] cnk: so I am not clear which should work
[19:41:33] JamesGames: the @ dient help. nil class
[19:42:57] JamesGames: listen guys I appreciate this. even if it never works. Thanks for time
[19:43:00] cnk: rubyonrailed: So the params passed don't match up very well with your order_params definition
[19:43:23] cnk: step 1 I think is to change that to just permit pickup_address... not pickup_address_attributes
[19:43:42] cnk: but not clear about the mismatch between line1, line2 and first_name, last_name....
[19:44:23] rubyonrailed: cnk: Yeah, not adding attributes at the end gives me a AssocationTypeMismatch
[19:44:59] ensyde__: has joined #RubyOnRails
[19:45:07] cnk: hmmm at what linenumber?
[19:45:17] cnk: at line 20? or up in the create method
[19:45:27] srinidhi: has joined #RubyOnRails
[19:45:34] JamesGames: omz: what do you think?
[19:46:19] rubyonrailed: It says line 4, but thats just in the order params, so it must be line 20. It doens't error when attributes is added.
[19:46:40] omz: have you successfully log in, james?
[19:46:59] prgmmr: has joined #RubyOnRails
[19:47:00] JamesGames: but then nil class
[19:47:36] omz: so current_user not nil?
[19:47:58] JamesGames: no it should be me. not nil
[19:48:45] JamesGames: saying that it's on the cloud not heroku, heroku has been acting up
[19:48:49] omz: what is your url when you got that error?
[19:49:12] JamesGames: https://mytestingspace-computron59.c9users.io/rooms/current.1
[19:49:34] omz: ok . i see
[19:49:47] JamesGames: really? that makes sense
[19:50:00] omz: so here is your code. @room = Room.find_by_name(current_user.room_name)
[19:50:24] omz: why current_user have room_name?
[19:51:11] JamesGames: I thought if the user had the name he was in then i could just call that room from the table and get it's attributes
[19:51:14] sumobob: has joined #RubyOnRails
[19:53:02] JamesGames: that was how i built the tabel
[19:53:26] diegoviola: do you folks test your controllers?
[19:53:49] diegoviola: I think it's a bit overkill when you just have a CRUD and not much logic in the controllers, aye?
[19:54:11] omz: i think you have a wrong query.
[19:54:27] JamesGames: ok. progress. what is that?
[19:54:35] omz: try other query. is it still error?
[19:55:14] hahuang61: has joined #RubyOnRails
[19:55:16] fox_mulder_cp: good evening. i have a model a and nested model b. in one method i set some for model b. how to save model b state properly with saving model a?
[19:55:22] djbkd: has joined #RubyOnRails
[19:55:42] JamesGames: I can simply put in Room.find_by_name("The Marsh"), and that works
[19:55:45] omz: or it could be you have not successfully logged in
[19:56:19] omz: current_user have name attribute?
[19:56:36] fox_mulder_cp: omz: only if u add it in migration
[19:56:40] omz: try print current_user.name on your view
[19:56:56] omz: or controller
[19:57:42] duderonomy: has joined #RubyOnRails
[19:58:12] omz: or current_user.email if you have. anything you have
[19:58:12] JamesGames: puts(current_user)
[19:58:48] fox_mulder_cp: p "#{current_user.inspect}"
[19:59:00] DTZUBDUB: has joined #RubyOnRails
[19:59:09] desnudopenguino: has joined #RubyOnRails
[20:01:13] JamesGames: you were right. undefined method `email' for nil:NilClass, no user!!!
[20:01:31] omz: ok. good
[20:01:35] cnk: we knew that 10 min ago
[20:01:42] cnk: and is @current_user also nil?
[20:01:58] JamesGames: i tried <%= @current_user.email %>
[20:02:08] cnk: that's in your view
[20:02:15] cnk: I am asking about in your controller
[20:02:17] jhack: has joined #RubyOnRails
[20:02:24] JamesGames: I set the room manually
[20:02:39] cnk: does your rooms controller have a before filter that puts current_user into scope?
[20:03:25] jenrzzz: has joined #RubyOnRails
[20:03:41] cnk: which view does @current_user.email work in? if that works ,you were logged in at some point
[20:05:22] haaj: has joined #RubyOnRails
[20:05:38] JamesGames: im not sure,
[20:05:45] shtirlic: has joined #RubyOnRails
[20:06:45] shtirlic: has joined #RubyOnRails
[20:07:15] JamesGames: ok that p did not print anything
[20:07:54] JamesGames: the rooms controller has no such filter
[20:08:20] JamesGames: wait, here's a gist
[20:09:26] JamesGames: https://gist.github.com/adam12/23550a91e9bb3fb6f6a2cd86c7ef9cf8
[20:09:40] c355E3B: has joined #RubyOnRails
[20:10:01] JamesGames: omz: what u think, what would do this?
[20:11:37] cnk: Go back to the Hartle tutorial you got your sessions code from and look to see how it is used in the other controller there
[20:11:47] cnk: PostsController if I recall correctly
[20:12:11] cnk: you haven't made current_user available within your RoomsController
[20:12:52] JamesGames: ok. how would I do that?
[20:12:52] ur5us: has joined #RubyOnRails
[20:13:10] diegoaguilar: has joined #RubyOnRails
[20:14:04] cnk: I don't know. I use devise. Since you created your own auth, you need to figure that out
[20:16:42] stephenmac7: has joined #RubyOnRails
[20:17:16] stephenmac7: Hey, I'm writing a migration that merges a bunch of columns into one, but those columns appear on multiple tables.
[20:17:36] omz: do you have authenticate_user method, james?
[20:17:54] stephenmac7: Is there any way to do something like Users.all but using a symbol (:users) to select the table?
[20:17:55] moeabdol: has joined #RubyOnRails
[20:18:23] omz: put it in room rooms_controller before_action :authenticate_user!
[20:19:31] havenwood: stephenmac7: Module.const_get(:user.capitalize).all
[20:20:13] [Butch]: has joined #RubyOnRails
[20:20:20] maucar: has joined #RubyOnRails
[20:20:24] diegoviola: if you have simple CRUD code like this, do you think it's still reasonable to add tests to controllers? https://github.com/diegoviola/colorpicker/blob/master/app/controllers/colors_controller.rb
[20:20:39] diegoviola: what are the most simple unit tests I can write for something like this?
[20:20:55] desnudopenguino: If you call render in an action to load a different view, is all the code below there still executed, or does the action end at this point?
[20:21:38] rodfersou: has joined #RubyOnRails
[20:22:17] stephenmac7: havenwood: Thanks!
[20:23:09] edwinvdgraaf: has joined #RubyOnRails
[20:27:38] jkwood: has joined #RubyOnRails
[20:27:40] epochwolf|2: has joined #RubyOnRails
[20:27:40] universa1: has joined #RubyOnRails
[20:27:40] many: has joined #RubyOnRails
[20:27:41] alevy: has joined #RubyOnRails
[20:27:42] ghormoon: has joined #RubyOnRails
[20:27:42] IanMalcolm: has joined #RubyOnRails
[20:27:42] Jon30: has joined #RubyOnRails
[20:27:42] Jon30: has joined #RubyOnRails
[20:27:43] rork: has joined #RubyOnRails
[20:27:44] Seich: has joined #RubyOnRails
[20:27:44] null__: has joined #RubyOnRails
[20:27:44] KorriX: has joined #RubyOnRails
[20:27:44] creature: has joined #RubyOnRails
[20:27:44] creature: has joined #RubyOnRails
[20:27:45] thorgi: has joined #RubyOnRails
[20:27:46] G: has joined #RubyOnRails
[20:27:46] veloutin: has joined #RubyOnRails
[20:27:47] voidfire: has joined #RubyOnRails
[20:27:48] tanuki: has joined #RubyOnRails
[20:27:48] _fortis: has joined #RubyOnRails
[20:27:48] Nuck: has joined #RubyOnRails
[20:27:49] Dimik: has joined #RubyOnRails
[20:27:49] boshhead: has joined #RubyOnRails
[20:27:51] FastJack: has joined #RubyOnRails
[20:27:53] funnel: has joined #RubyOnRails
[20:27:53] dionysus69: has joined #RubyOnRails
[20:27:53] Olipro: has joined #RubyOnRails
[20:27:54] AzaToth: has joined #RubyOnRails
[20:27:55] dever: has joined #RubyOnRails
[20:27:59] marienz: has joined #RubyOnRails
[20:28:00] context: has joined #RubyOnRails
[20:28:01] lupine: has joined #RubyOnRails
[20:28:02] hahuang65: has joined #RubyOnRails
[20:28:03] cschneid: has joined #RubyOnRails
[20:28:04] maxx88: has joined #RubyOnRails
[20:28:05] moei: has joined #RubyOnRails
[20:28:05] emachnic: has joined #RubyOnRails
[20:28:08] arBmind: has joined #RubyOnRails
[20:28:09] hive-mind: has joined #RubyOnRails
[20:28:12] nickjj: has joined #RubyOnRails
[20:28:29] gingray: has joined #RubyOnRails
[20:28:37] ErhardtMundt: has joined #RubyOnRails
[20:28:38] Y_Ichiro: has joined #RubyOnRails
[20:28:38] Y_Ichiro: has joined #RubyOnRails
[20:28:40] dopie: has joined #RubyOnRails
[20:28:50] jcp: has joined #RubyOnRails
[20:28:59] kdisneur: has joined #RubyOnRails
[20:29:11] jord: has joined #RubyOnRails
[20:29:13] c355E3B: has joined #RubyOnRails
[20:29:13] tfitts: has joined #RubyOnRails
[20:29:14] iooner: has joined #RubyOnRails
[20:29:21] aeruder: has joined #RubyOnRails
[20:29:52] tpendragon: has joined #RubyOnRails
[20:29:55] whathappens: has joined #RubyOnRails
[20:30:05] RubyNewbey_____: has joined #RubyOnRails
[20:30:12] dionysus69: I think I found a bug. I am going to route and it gives no route found error because it tries to go to: 1/admin/products, instead of admin/products/1
[20:30:13] pipework: has joined #RubyOnRails
[20:30:26] dionysus69: I have same exact setup on different routes and those work
[20:30:48] mostlybadfly: has joined #RubyOnRails
[20:30:53] hjdivad: has joined #RubyOnRails
[20:30:56] jxf: has joined #RubyOnRails
[20:31:19] fox_mulder_cp: dionysus69: rake routes?
[20:31:24] Hates_: has joined #RubyOnRails
[20:31:28] Sylario: has joined #RubyOnRails
[20:31:31] fox_mulder_cp: gist routes.rb, plz
[20:31:35] meinside: has joined #RubyOnRails
[20:31:40] Radar: has joined #RubyOnRails
[20:31:42] pokEarl: has joined #RubyOnRails
[20:32:04] dionysus69: https://gist.github.com/webzorg/b336665f445aade31d626a038685ec3b
[20:32:19] incidence: has joined #RubyOnRails
[20:32:23] DukeDave: has joined #RubyOnRails
[20:32:34] Travis-42: has joined #RubyOnRails
[20:32:49] darrik: has joined #RubyOnRails
[20:32:50] dionysus69: added routes.rb to the same gist
[20:33:12] Leepoff: has joined #RubyOnRails
[20:33:40] draig: has joined #RubyOnRails
[20:33:41] swgillespie: has joined #RubyOnRails
[20:33:45] dionysus69: IF it is a bug, I would think its because of something weird is going on with locale, because id of a product goes in place of a locale
[20:33:51] jcugno__: has joined #RubyOnRails
[20:34:17] robbkidd: has joined #RubyOnRails
[20:34:22] barttenbrinke: has joined #RubyOnRails
[20:34:34] krainboltgreene: has joined #RubyOnRails
[20:34:51] graft: has joined #RubyOnRails
[20:34:53] sdn90: has joined #RubyOnRails
[20:34:55] deeprave: has joined #RubyOnRails
[20:35:06] fujinuma: has left #RubyOnRails: ("Leaving")
[20:35:34] acalewin: has joined #RubyOnRails
[20:35:40] SuppliedRelic: has joined #RubyOnRails
[20:35:42] fox_mulder_cp: dionysus69: git view.rb.html plz, with this 'bugged' url
[20:36:05] macsteps: has joined #RubyOnRails
[20:36:51] dionysus69: by view your mean show or edit?
[20:36:52] chandlerbing: has joined #RubyOnRails
[20:36:58] dionysus69: or what is rb.html at all
[20:37:20] dionysus69: I have 5 routes like this and 3 are affected by it
[20:37:35] dionysus69: code is same in all of them so its even weirder in this case
[20:37:37] fox_mulder_cp: dionysus69: i mean view code
[20:37:42] macsteps_: has joined #RubyOnRails
[20:37:43] Guest4184_______: has joined #RubyOnRails
[20:37:53] kumavis: has joined #RubyOnRails
[20:38:05] dionysus69: this is in show html.erb
[20:38:06] dionysus69: <%= link_to 'Edit', edit_admin_product_section_path(@admin_product_section), class: "button" %>
[20:38:06] dionysus69: <%= link_to 'Back', admin_product_sections_path, class: "button warning" %>
[20:38:20] dionysus69: this is in edit html.erb
[20:38:20] whathappens: has joined #RubyOnRails
[20:38:21] dionysus69: %= link_to 'Show', admin_product_sections_path(@admin_product_section) , class: "button" %>
[20:38:21] dionysus69: <%= link_to 'Back', admin_product_sections_path , class: "button warning" %>
[20:38:35] dionysus69: this ONLY happens when I am trying to go from edit page to the show
[20:38:45] dionysus69: if I go to show from index page, it works
[20:39:06] machty: has joined #RubyOnRails
[20:39:43] Obi_obi___: has joined #RubyOnRails
[20:40:03] spastorino: has joined #RubyOnRails
[20:40:20] jhill: has joined #RubyOnRails
[20:40:26] Caerus|Away: has joined #RubyOnRails
[20:40:48] xall: has joined #RubyOnRails
[20:40:57] eljimmy: has joined #RubyOnRails
[20:41:32] dionysus69: very weird isn't ?
[20:41:52] Radar: has joined #RubyOnRails
[20:41:54] fox_mulder_cp: i'm not ready to answer...
[20:42:08] unreal: has joined #RubyOnRails
[20:42:17] Radar: %= link_to 'Show', admin_product_sections_path(@admin_product_section) , class: "button" %>
[20:42:24] Radar: Why is this admin_product_sections and not admin_product_section
[20:42:30] Radar: p.s. GOOD MORNING
[20:42:53] fox_mulder_cp: ACTION drink some beers for a 2 lat hours..
[20:43:01] fox_mulder_cp: Radar: good evening :)
[20:43:48] dionysus69: Radar it works though, good night from here
[20:44:26] AmiMoench: has joined #RubyOnRails
[20:44:30] nyandoge: has joined #RubyOnRails
[20:44:51] fedruantine: has joined #RubyOnRails
[20:45:40] edwinvdgraaf: has joined #RubyOnRails
[20:45:51] dionysus69: I found the reason I am dealing with stuff
[20:45:55] Radar: dionysus69: But you're using a plural route to link to the "show" route... which should be a singular helper.
[20:45:57] dionysus69: admin_product_sections_path(@admin_product_section) works
[20:46:04] dionysus69: admin_product_section_path(@admin_product_section) works also
[20:46:04] Lewix: has joined #RubyOnRails
[20:46:23] dionysus69: admin_award_path(@admin_award) works
[20:46:29] edwinvdgraaf: has joined #RubyOnRails
[20:46:31] dionysus69: admin_awards_path(@admin_award) doesn't work
[20:46:37] dionysus69: it is not consistent
[20:47:42] dionysus69: how do you explain using singular/plural for admin products section route and it working in both cases?
[20:48:11] dionysus69: maybe ruby pluralize method chokes on those long route names?
[20:48:22] elementaru: has joined #RubyOnRails
[20:48:22] kitsuneyo: has joined #RubyOnRails
[20:48:26] alfiemax: has joined #RubyOnRails
[20:50:20] adac: has joined #RubyOnRails
[20:52:19] roamingdog: has joined #RubyOnRails
[20:55:01] d0nn1e: has joined #RubyOnRails
[20:55:59] hahuang61: has joined #RubyOnRails
[20:56:28] rodfersou: has joined #RubyOnRails
[20:57:00] rubyonrailed: has joined #RubyOnRails
[20:57:58] macsteps: has joined #RubyOnRails
[20:58:53] jowiar: has joined #RubyOnRails
[21:00:29] fox_mulder_cp: Radar: i know, that u is a magician :)
[21:01:03] Radar: dionysus69: !routing
[21:01:03] helpa: dionysus69: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[21:01:21] kitsuneyo: has joined #RubyOnRails
[21:01:40] roamingdog: has joined #RubyOnRails
[21:02:21] jgt: has joined #RubyOnRails
[21:02:52] rubyonrails627: has joined #RubyOnRails
[21:03:25] jenrzzz_: has joined #RubyOnRails
[21:03:36] douglascorrea: has joined #RubyOnRails
[21:06:15] mixnblend: has joined #RubyOnRails
[21:06:31] kitsuneyo: has joined #RubyOnRails
[21:07:14] haaj: has joined #RubyOnRails
[21:09:26] Cache_Money: has joined #RubyOnRails
[21:09:48] meoblast001: has joined #RubyOnRails
[21:15:25] goodroot: anyone here have experience with slim?
[21:16:21] jenrzzz: has joined #RubyOnRails
[21:19:05] peterppp: has left #RubyOnRails: ("Leaving")
[21:20:03] helpa: has joined #RubyOnRails
[21:20:32] chopin: has joined #RubyOnRails
[21:23:15] Axy: has joined #RubyOnRails
[21:25:11] JamesGames: has joined #RubyOnRails
[21:28:31] peterppp: has joined #RubyOnRails
[21:28:50] voidDotClass: has joined #RubyOnRails
[21:30:29] yfeldblum: has joined #RubyOnRails
[21:31:01] peterppp: what's the right way to deal with invalid request parameters in a controller? seems like a stupid question but I can't really find an answer to it
[21:31:37] kitsuneyo: has joined #RubyOnRails
[21:33:47] djbkd: has joined #RubyOnRails
[21:35:30] centrx: has joined #RubyOnRails
[21:36:46] `0ctayn: has joined #RubyOnRails
[21:39:36] kitsuneyo: has joined #RubyOnRails
[21:39:48] `0ctayn: has joined #RubyOnRails
[21:40:32] jowiar: has joined #RubyOnRails
[21:45:48] jenrzzz: has joined #RubyOnRails
[21:46:14] kitsuneyo: i just ran rake test:integration 3 times. first time i got 6, 10, then 7 errors with the same capybara tests. i switched back from selenium to the default driver. i don't understand why.
[21:47:11] kitsuneyo: this is the login helper method that causes the errors: https://gist.github.com/kitsuneyo/8f64a870ed8f8513425bc4e5d8f40f05
[21:47:43] kitsuneyo: at the moment the error is Unable to find field "nav-login-username"
[21:50:31] siaw23: has joined #RubyOnRails
[21:53:28] djbkd: has joined #RubyOnRails
[21:54:27] ChanServ: +o baweaver
[21:55:25] ChanServ: -o baweaver
[21:56:44] hahuang61: has joined #RubyOnRails
[21:57:17] jtong: has joined #RubyOnRails
[21:57:30] allcentury: has joined #RubyOnRails
[21:58:19] jtong: has joined #RubyOnRails
[21:59:18] robot: has joined #RubyOnRails
[22:01:45] macsteps: has joined #RubyOnRails
[22:02:40] emachnic: has joined #RubyOnRails
[22:03:25] urbanmonk: has joined #RubyOnRails
[22:04:22] djbkd: has joined #RubyOnRails
[22:05:24] sumobob: has joined #RubyOnRails
[22:05:33] djbkd: has joined #RubyOnRails
[22:05:37] mrbubbles: has joined #RubyOnRails
[22:06:05] moeabdol: has joined #RubyOnRails
[22:10:44] voidDotClass: has joined #RubyOnRails
[22:10:45] Oliphaunte: has joined #RubyOnRails
[22:12:54] rubyonrailed: has joined #RubyOnRails
[22:14:13] dcunit3d: has joined #RubyOnRails
[22:21:00] Darmani: has joined #RubyOnRails
[22:22:56] oystersauce8: has joined #RubyOnRails
[22:27:10] d0nn1e: has joined #RubyOnRails
[22:30:12] patrick_star_3: has joined #RubyOnRails
[22:32:10] davidw: Hi, I've got something setting a config variable that should not be, I think - any idea how I could trace the culprit?
[22:32:24] davidw: Rails.application.config.assets.digest is being set to false, in production
[22:33:03] jgt: has joined #RubyOnRails
[22:42:16] ltd: has joined #RubyOnRails
[22:42:27] eggoez: has joined #RubyOnRails
[22:42:46] jowiar: has joined #RubyOnRails
[22:43:28] solars: has joined #RubyOnRails
[22:45:54] JamesGames: has joined #RubyOnRails
[22:47:27] JamesGames: Hello. Anyone know how to make diffrent resources available in controllers? I just tried resources :users
[22:47:27] JamesGames: resources :rooms, controller: 'users'
[22:49:45] adam12: JamesGames: That's likely not what you want
[22:50:01] adam12: JamesGames: What are you trying to achieve?
[22:50:05] JamesGames: but Im still getting nil class no method error
[22:50:12] havenwood: davidw: How's it set in?: config/environments/production.rb
[22:50:17] eggoez: has joined #RubyOnRails
[22:50:31] havenwood: davidw: In production what's your?: Rails.env
[22:50:38] adam12: JamesGames: Totally unrelated. Make a gist with the error and the code the error refers to.
[22:50:40] JamesGames: no I just put it in routes.
[22:50:48] davidw: havenwood, it wasn't set there. Setting it there fixes the problem, but it's supposed to default to true
[22:53:35] havenwood: davidw: Is it just default to true only because it's default set to true there though?
[22:53:40] JamesGames: https://gist.github.com/anonymous/df2612f90ef55d77e9c3b359de9a23ca
[22:54:11] JamesGames: the error is line 2, when a reference is made to the user
[22:54:28] adam12: JamesGames: <%= @current_user.email %> refers to an instance variable. In your case, current_user is a helper so doesn't need the @
[22:55:08] davidw: havenwood, no, it defaults to true in production
[22:55:20] davidw: http://guides.rubyonrails.org/asset_pipeline.html#in-production
[22:55:44] JamesGames: adam: it still errors the same message
[22:56:30] adam12: JamesGames: Maybe you're not logged in?
[22:57:13] dcunit3d: has joined #RubyOnRails
[22:57:27] hahuang61: has joined #RubyOnRails
[22:57:31] flashpoint9: has joined #RubyOnRails
[22:58:01] havenwood: davidw: I'm just pointing out it's default set to true in config/environments/production.rb with a fresh: rails new
[22:58:02] havenwood: davidw: It's set to true, making the default true.
[22:58:07] JamesGames: I thought that. but it refuses to run on heroku, so I activated the user (me) by hand, thenlog in as normal. the url i get is :https://mytestingspace-computron59.c9users.io/rooms/current.1
[22:58:08] havenwood: davidw: Maybe I'm misunderstanding you.
[22:58:32] davidw: havenwood, yeah, it *should* be true in production. It's not
[22:58:35] davidw: something is messing with it
[22:59:01] havenwood: "davidw: havenwood, it wasn't set there. Setting it there fixes the problem, but it's supposed to default to true"
[22:59:22] davidw: ahhh, ok, sorry I misread you
[22:59:27] adam12: JamesGames: Your redirect code is likely wrong.
[22:59:31] havenwood: davidw: Ah, so you're just wondering how it disappeared from the production.rb file?
[22:59:42] jtong: has joined #RubyOnRails
[23:00:11] adam12: JamesGames: That line you're having a problem with, you should check if you have a current user, before you ask for it's email.
[23:00:13] JamesGames: the user redirect or the routes.rb?
[23:00:40] adam12: JamesGames: The redirect. The # at the end of the URL is likely the ID of something (your user perhaps). It's irrelevant for the route, since you stick the user in session.
[23:01:58] adam12: JamesGames: https://gist.github.com/adam12/e3cb82e1de14241f754d6946da9a0d67
[23:02:05] JamesGames: redirect_to current_room_path user
[23:02:23] adam12: Yeah - that's wrong. Leave off `user`.
[23:02:34] adam12: The user id is in the session
[23:02:39] adam12: and you fetch it when you call `current_user`
[23:03:02] adam12: If when you call current_user you get nil (or a nil error), either the user in the session doesn't exist or the session doesn't have a user id in it.
[23:04:00] JamesGames: ok I take off the 'user'
[23:04:08] adam12: Wont' fix your current issue tho
[23:04:18] adam12: See the code I posted. My guess is you're not logged in, hence the error.
[23:04:56] davidw: still kind of odd, but I guess that clears that up
[23:04:58] xall_: has joined #RubyOnRails
[23:05:35] JamesGames: ok. I guess im not logged in
[23:05:42] jenrzzz: has joined #RubyOnRails
[23:05:42] jenrzzz: has joined #RubyOnRails
[23:05:59] SteenJobs: has joined #RubyOnRails
[23:06:07] whathappens: has joined #RubyOnRails
[23:06:14] JamesGames: so what is ?
[23:06:37] JamesGames: u want i try this on heroku?
[23:06:49] adam12: I don't follow
[23:07:22] JamesGames: u want I deploy the app on the cloud server "Heroku"?
[23:07:39] JamesGames: how could I not be logged in?
[23:07:59] adam12: JamesGames: I'm not sure? but if you are seeing the message about not being logged in, you need to login.
[23:08:04] quazimod1: has joined #RubyOnRails
[23:08:04] quazimodo: has joined #RubyOnRails
[23:08:16] adam12: JamesGames: Makes no difference where you are running it.
[23:09:00] JamesGames: i followed the MHartle book. We did the login that way
[23:09:55] adam12: If you expect the person to be logged in to view a room, you need to write the code to ensure that.
[23:10:16] adam12: I'm not sure what the MHartle book is, but I believe RailsTutorial has something similar. A before_action call that checks the user is logged in.
[23:10:16] xall: has joined #RubyOnRails
[23:10:48] JamesGames: i thought i had that.
[23:10:58] adam12: Maybe you do, in a different controller
[23:11:08] adam12: If you want it for /rooms, stick it in the RoomsController as well.
[23:12:00] JamesGames: i put the sessions controller in a gist --https://gist.github.com/anonymous/856e73151726ab53c8aeda1503ba328e
[23:12:31] JamesGames: if logged_in?
[23:12:48] adam12: Only mildly relevant.
[23:12:58] adam12: What's the source for `logged_in?`
[23:13:22] adam12: Gist your entire routes.rb file and your session helper
[23:14:50] JamesGames: https://gist.github.com/anonymous/d7e0300975adb51039ab0637d1e00ea8
[23:14:59] JamesGames: did i gist that right
[23:15:34] JamesGames: def log_in(user)
[23:15:34] JamesGames: session[:user_id] = user.id
[23:16:08] quazimodo: has joined #RubyOnRails
[23:16:56] quazimod1: has joined #RubyOnRails
[23:17:16] adam12: JamesGames: First - fix your resources :rooms to point back to RoomsController and not UsersController.
[23:17:40] Darmani: Radar: breh.
[23:18:44] Synthead: has joined #RubyOnRails
[23:18:51] rubyonrailed: has joined #RubyOnRails
[23:19:23] JamesGames: I was trying to make both available in one controller
[23:19:42] adam12: JamesGames: Add this to your ApplicationController: https://gist.github.com/adam12/753dc109da86cfa45785752dc773056b
[23:20:05] adam12: JamesGames: And in the top of your RoomsController, add "before_action :require_user". Right below the `class RoomsController` line.
[23:20:08] jowiar: has joined #RubyOnRails
[23:20:13] adam12: JamesGames: Hopefully that keeps you going. I gotta run.
[23:20:24] Darmani: baweaver: check one two one two
[23:21:12] yfeldblum: has joined #RubyOnRails
[23:22:12] pawnbox: has joined #RubyOnRails
[23:23:52] dalbusch1t: has joined #RubyOnRails
[23:24:29] macsteps: has joined #RubyOnRails
[23:29:36] fedruantine: has joined #RubyOnRails
[23:37:12] rogue_koder: has joined #RubyOnRails
[23:39:50] akshat: has joined #RubyOnRails
[23:40:21] JamesGames: OK. back to basics. Stop me anyone if you see the error! : The form links like this: <%= f.submit "Log in", class: "btn btn-primary" %>, and the route in the routes file is this: get 'login' => 'sessions#new'
[23:40:21] JamesGames: post 'login' => 'sessions#create'
[23:41:23] JamesGames: and the login in the sessions helper is this : if user.activated?
[23:41:47] Jasaka: has joined #RubyOnRails
[23:42:36] JamesGames: I reckon the name should be "Log_in" consistantly across all files?
[23:43:36] JamesGames: Im gonna change the form to the action "Log_in" instead of "Log in"
[23:44:31] JamesGames: and im changing the routes.rb and the session helper too
[23:47:30] JamesGames: and i have a new error!
[23:47:40] JamesGames: uninitialized constant ActionView::CompiledTemplates::Log_in_path
[23:47:47] JamesGames: what the hell?
[23:48:08] riskish: has joined #RubyOnRails
[23:49:22] Darmani: JamesGames: Dude James. Instead of spamming the chat, why don't you go study those errors.
[23:50:00] Darmani: JamesGames: Hint, Google is your friend.
[23:50:36] Darmani: JamesGames: You might also want to join the Slack chat for Rails. If no one here is around someone over there can usually help.
[23:51:01] JamesGames: Ive been at this without any results for 4 days.
[23:52:02] quazimodo: has joined #RubyOnRails
[23:52:05] quazimod1: has joined #RubyOnRails
[23:53:11] dcunit3d: has joined #RubyOnRails
[23:54:00] jgt: has joined #RubyOnRails
[23:54:13] pawnbox: has joined #RubyOnRails
[23:54:17] moeabdol: has joined #RubyOnRails
[23:55:25] Cache_Money: has joined #RubyOnRails
[23:55:59] gheegh: has joined #RubyOnRails
[23:56:44] upsell5: has joined #RubyOnRails
[23:57:03] douglascorrea: has joined #RubyOnRails
[23:57:55] SteenJobs: if a user tries purchasing an item, but hasn’t registered payment info, what’s the best way to keep track of the item they selected so that after i onboard them for payment info i can continue the purchase flow (show them confirmation for the product they selected)? is session the way to go?
[23:58:12] hahuang61: has joined #RubyOnRails