« Back to channel list

#RubyOnRails - 29 August 2015

« Back 1 day Forward 1 day »
[00:01:51] hnanon: In my Order model I have: https://gist.github.com/anonymous/487c945e5973e7abc85a
[00:02:52] hnanon: When the webhook fires, I get the error: NoMethodError (undefined method `id' for nil:NilClass):
[00:04:30] smathy: hnanon, so either customer or product are nil
[00:05:48] jxpx777: has joined #RubyOnRails
[00:06:04] nya: has joined #RubyOnRails
[00:06:25] rhizome: Travis-42: why are you using _type
[00:06:48] chrishough: has joined #RubyOnRails
[00:07:41] wildlander: has joined #RubyOnRails
[00:07:56] Travis-42: rhizome: what do you mean?
[00:08:25] rhizome: huh, _array, too. hungarian notation?
[00:08:34] hnanon: smathy: customer id is being saved, but not product.
[00:08:54] hnanon: However, I see the SQL selecting the product in the logs.
[00:09:06] smathy: rhizome, polymorphic association.
[00:09:25] smathy: (I can't explain _array :)
[00:09:28] hnanon: Product Load (0.5ms) SELECT "products".* FROM "products" WHERE "products"."year" = ? AND "products"."month" = ? ORDER BY "products"."id" DESC LIMIT 1 [["year", 2015], ["month", "8"]]
[00:09:39] rhizome: if it is polymorphic, i might have something to say about that.
[00:09:49] Travis-42: rhizome: I was using hungarian notiation just to make it clear in the IRC channel, that it was an array
[00:10:12] smathy: hnanon, Just because you see the SQL doesn't mean that it returned anything.
[00:10:32] Travis-42: ???Vote.where(votable: votables)??? where votables is an array of objects that could be several types that match the votable polymorphic association on Vote
[00:10:49] hnanon: Yeah, I just noticed that now...
[00:11:07] smathy: hnanon, also, if you're getting that NoMethodError exception, then the whole `self.create` call will fail, so there's no way that's saving the customer.id in the DB.
[00:11:14] hnanon: I just checked the Products table and noticed that the month is saved with a leading zero.
[00:11:37] rhizome: Travis-42: you know you'll have ids?
[00:11:40] smathy: No comment re having `month` be a string.
[00:12:06] hnanon: smathy: Yes, of course. I should have said it was saving before I included the product id.
[00:12:21] rhizome: let's talk about a Coupon model having both percentages and dollar possibilities
[00:12:33] Travis-42: rhizome: the following code is the basic idea, I was just hoping for something more elegant, https://gist.github.com/anonymous/f74f0af5d4380b751ddb
[00:12:49] chipotle: has joined #RubyOnRails
[00:12:50] hnanon: smathy: Why should month be saved as an integer if no math is being done on it?
[00:13:12] smathy: hnanon, so you never have to worry about precisely the problem that just bit you.
[00:13:13] rhizome: Travis-42: lotsa undefined things in there
[00:13:24] rhizome: try plain english
[00:13:55] nahtnam: rhizome: Why should I make a service?
[00:14:23] erich: has joined #RubyOnRails
[00:14:31] drale2k: has joined #RubyOnRails
[00:14:41] rhizome: because that's what you're doing and it'll clean up your controller. also, there appear to be steam gems.
[00:14:49] workmad3: has joined #RubyOnRails
[00:14:56] Travis-42: rhizome: I have an array of objects that can be voted on, of multiple class types. I want to create a single query to retrieve the current user???s votes on those objects??? ???SELECT * FROM votes WHERE user_id = 6 AND ((votable_type = ???Article??? AND votable_id IN [1,2,3]) OR (votable_type = ???Blog??? AND votable_id IN [4,5,6]))??? would be the equivalent sql query
[00:16:01] Travis-42: Rails generates the correct query if votables is a single type when using ???current_user.votes.where(votable: votables)???, I was just hoping there was a way to do it if votables encompasses multiple types, since votable is a polymorphic association
[00:16:10] nahtnam: rhizome: Steam gems?
[00:16:46] hnanon: smathy: noted
[00:17:09] maz-dev: has joined #RubyOnRails
[00:17:34] rhizome: Travis-42: i tell you what i do in a similar situation: @vs = Votable.find(ids); @vs.each{|voteable| render votable.type, object: votable}
[00:17:45] rhizome: Travis-42: is there a reason why the query has to be so specific?
[00:17:50] idd2d: has joined #RubyOnRails
[00:18:58] rhizome: nahtnam: ruby gems for interacting with the steam api
[00:19:18] rhizome: bbiab store
[00:19:29] nahtnam: Yeah, was just looking at steam-condenser
[00:19:53] nahtnam: Gonna set that up
[00:20:08] smathy: nahtnam, a service object, not a service - so that instead of all this code in your controller: https://gist.github.com/nahtnam/a5637141bd35a288ec5f#file-messy_controller-rb-L13-L82 you could have simply: @stats = YourStatsClass.new request["playerstats"]["stats"]; render json: @stats
[00:21:06] hnanon_: has joined #RubyOnRails
[00:21:10] smathy: (in fact you can have just: render json: YourStatsClass.new(request["playerstats"]["stats"])
[00:22:16] kies: has joined #RubyOnRails
[00:22:51] Travis-42: the reason was that each of the ???votables??? is cached on multiple levels (including the vote buttons), and so we were filling in the vote states with javascript. but, I suppose my approach will work
[00:23:10] smathy: nahtnam, actually, you'll need to pass params[:username] in as well.
[00:23:28] nahtnam: smathy: Hm ok.
[00:23:32] smathy: (and also replace lines 9-11
[00:24:01] nahtnam: But that still doesnt solve the problem of "I just realized that the Steam API returnes different arrays based on different users (which is stupid IMO). So, sometimes fields are missing and my controller throws an error because it cant find it."
[00:24:04] smathy: nahtnam, biggest advantage of that is that now you can write a test for YourStatsClass which you can't really do right now.
[00:24:40] smathy: nahtnam, it doesn't solve it directly, no, but better to deal with it in YourStatsClass than inline in your show method.
[00:24:52] nahtnam: ill split them up now
[00:24:56] To_the_window: has joined #RubyOnRails
[00:25:07] nahtnam: before that, ill try out a gem
[00:25:08] annlewis: has joined #RubyOnRails
[00:25:29] smathy: ...so really, your request was to make your code more resilient - moving things out into a service object is the answer to that.
[00:25:34] bootstrappm: hey I disabled the asset pipeline when generating a new Rails project. The default layout though kept the lines for "stylesheets/application.css" and "javascripts/application.js", though, and its giving me 404s. Is the only way to have those routes get the files from app/assets/* in dev by enabling the asset pipeline?
[00:25:36] smathy: (or *an* answer to that at least)
[00:26:15] smathy: bootstrappm, yes.
[00:27:17] To_the_window: where can I find bots?
[00:27:21] To_the_window: Bots with games? xd
[00:28:03] smathy: bootstrappm, the layout is generated when a new app is generated - so you could just alter your template to remove those lines.
[00:28:12] yfeldblum: has joined #RubyOnRails
[00:28:15] smathy: To_the_window, over in #php
[00:29:26] bootstrappm: thanks smathy, whats a good way to work w/ assets w/o the pipeline? Should I just forget about app/assets altogether and put things in public?
[00:30:20] nertzy: has joined #RubyOnRails
[00:30:20] smathy: bootstrappm, I don't think there's any good way to work with assets without the pipeline :) But yes, if you have no asset pipeline then you'll need to put files directly into your public.
[00:31:41] bruno-: has joined #RubyOnRails
[00:33:04] atomical: has joined #RubyOnRails
[00:34:16] bootstrappm: would symlinking public/assets to app/assets be a security risk or is that fine?
[00:37:16] seank_: has joined #RubyOnRails
[00:37:41] SteenJobs: has joined #RubyOnRails
[00:38:22] Travis-42: if you???re going to do that, would there be any reason not to just put them in public?
[00:38:32] christiandsg: has joined #RubyOnRails
[00:38:36] Travis-42: are they doing anything else there?
[00:39:30] bootstrappm: not any reason I can think of other than that all the generators stick them in app/assets so I'd have to move them every time
[00:39:35] HalcyonicStorm: has joined #RubyOnRails
[00:40:32] Travis-42: you could customize the generators as an option too
[00:41:01] livathinos: has joined #RubyOnRails
[00:43:17] Mia: has joined #RubyOnRails
[00:44:55] seank_: has joined #RubyOnRails
[00:46:22] bootstrappm: alright I disabled the asset pipeline because I really just didn't want to work with coffeescript but its leading to too many issues. Is it possible to use the asset pipeline without using coffeescript? If I don't have the coffee gem will the assets still be compiled?
[00:46:35] Rubie: has joined #RubyOnRails
[00:47:23] erichu: has joined #RubyOnRails
[00:48:11] smathy: bootstrappm, of course.
[00:48:27] smathy: ...even if you leave coffee gem, you can always just use JS.
[00:48:55] smathy: ...just name your file appropriately, and probably you should read this to avoid any other misunderstandings: http://guides.rubyonrails.org/asset_pipeline.html
[00:49:40] bootstrappm: yeah I'm on that page now, its just so long and its friday :(
[00:50:43] blackhuey: has joined #RubyOnRails
[00:51:49] smathy: bootstrappm, right, so just name your files with .js extensions and they'll Just Work???
[00:54:28] HalcyonicStorm: has joined #RubyOnRails
[00:54:59] bkxd: has joined #RubyOnRails
[00:56:02] ur5us: has joined #RubyOnRails
[00:57:54] nahtnam: How can I access this? https://github.com/koraktor/steam-condenser-ruby/blob/master/lib/steam-condenser/community/game_stats.rb I tried to do `SteamCondenser::Community::GameStats.new(76561198078575017, 730)` but no luck
[00:58:50] allcentury: has joined #RubyOnRails
[00:59:52] nya: has joined #RubyOnRails
[00:59:56] rromanchuk: has joined #RubyOnRails
[01:04:12] Swappticon: has joined #RubyOnRails
[01:06:33] jxpx777: has joined #RubyOnRails
[01:08:07] superlou: has joined #RubyOnRails
[01:09:51] andessen: has joined #RubyOnRails
[01:09:55] bkxd: has joined #RubyOnRails
[01:10:24] nya: has joined #RubyOnRails
[01:11:18] chipotle: has joined #RubyOnRails
[01:11:21] nahtnam: So I am setting my JSON like this: https://gist.github.com/nahtnam/4ce2aa35f5daf42cd054
[01:11:35] nahtnam: but it breaks if a single thing is missing
[01:11:41] Limix: has joined #RubyOnRails
[01:12:28] nahtnam: Is there a way I can make it so that the missing variables arent appended to @stats?
[01:12:31] nahtnam: (updated gist)
[01:12:36] yfeldblum: has joined #RubyOnRails
[01:14:44] nahtnam: * without adding a if statement everywhere?
[01:15:38] drale2k: has joined #RubyOnRails
[01:18:53] x-light: has joined #RubyOnRails
[01:19:09] wethu: has joined #RubyOnRails
[01:20:44] TheWhiteOx: has joined #RubyOnRails
[01:22:38] fast_scooter: has joined #RubyOnRails
[01:23:12] TheWhiteOx: Hey guys what's the best front end Javascript framework to integrate with a Rails backend?
[01:25:08] nahtnam: TheWhiteOx: That is a very opinion based question
[01:25:12] nahtnam: But I like Emberjs
[01:25:47] TheWhiteOx: Icic, our company is trying to refactor away from Rails to have an independent front end framework
[01:25:53] annlewis: has joined #RubyOnRails
[01:26:55] nahtnam: I think this api does what I need on these lines: https://github.com/koraktor/steam-condenser-ruby/blob/9861ec9a9b27304b33f8e6a26e482548266d33f0/lib/steam-condenser/community/game_stats.rb#L62-L74
[01:27:00] nahtnam: But I dont understand what is going on
[01:27:05] dnewkerk: TheWhiteOx: I like Marionette.js
[01:27:57] Limix: has joined #RubyOnRails
[01:28:00] TheWhiteOx: icic, thanks for the replies i'll do some research
[01:28:58] dnewkerk: TheWhiteOx: check out the Gitter chat room for Marionette, the core devs hang out helping all the time, very friendly
[01:29:15] TheWhiteOx: Awesome advice, thanks!
[01:29:29] lipoqil: has joined #RubyOnRails
[01:31:01] charliesome: has joined #RubyOnRails
[01:32:28] seank_: has joined #RubyOnRails
[01:33:30] bootstrappm: has left #RubyOnRails: ()
[01:33:54] nahtnam: I am thinking of doing: https://gist.github.com/nahtnam/2c92d699b9ebadc9be91 and append onto json
[01:34:12] nahtnam: which will stop it from failing if something is missing
[01:34:27] nahtnam: Is this good or bad/inefficient?
[01:34:34] Limix: has joined #RubyOnRails
[01:36:28] dnewkerk: looking for advice on choosing between Resque and Sidekiq for my background jobs??? what do people prefer these days?
[01:37:11] craysiii: in one of my migrations ive something like this: add_column :items, :completed, :boolean, :default => false, but in my schema it's not reflected after i do the migration. help?
[01:39:16] ur5us: has joined #RubyOnRails
[01:42:28] Radar: craysiii: Did the migration actually run?
[01:42:35] Radar: dnewkerk: Sidekiq by a long shot.
[01:42:44] craysiii: but it does not show in schema
[01:42:54] Radar: dnewkerk: http://sidekiq.org/ "What if 1 Sidekiq process could do the job of 20 Resque or DelayedJob processes?"
[01:43:00] Radar: craysiii: Then the migration did not run.
[01:43:08] rails998: has joined #RubyOnRails
[01:43:14] craysiii: it adds the column though.
[01:43:19] craysiii: just doesn't set default value
[01:46:01] helpa: has joined #RubyOnRails
[01:46:10] Radar: !botsnack
[01:46:10] helpa: Nom nom. Thanks, Radar!
[01:46:15] Radar: Theeere we go.
[01:47:15] dnewkerk: Radar: awesome thanks for the advice! As a related side question if you (or anyone) has a moment, while I was able to get Resque and Sidekiq working easily in development, I???m not sure what best practice is for production. I???ve started reading about god, monit, upstart, and inspeqtor, but not sure what to do quite yet (running redis not the issue, just how do you start up and keep workers running happily)
[01:47:27] Radar: dnewkerk: I use an upstart script to run mine.
[01:47:34] Radar: Stolen right from Sidekiq
[01:47:42] Radar: https://github.com/mperham/sidekiq/tree/master/examples/upstart
[01:48:28] dnewkerk: Radar: sweet, and you find things run smoothly, don???t need micromanaging from god/etc (so to speak) ;)
[01:48:33] Radar: For ensuring that they stay up, we log their metrics to datadog and then have monitors there which alert us when they stop responding
[01:48:46] Radar: dnewkerk: upstart SHOULD deal with them if they go down... but they haven't so far.
[01:48:58] Radar: One of them was looping on a single job for about a week and we didn't notice. It ran it 100mil times.
[01:49:08] Radar: No performance degredation
[01:49:16] Radar: <3 Sidekiq
[01:49:32] Radar: And I'm actually deploying https://github.com/radar/twist this morning which uses Sidekiq too.
[01:49:41] roxtrongo: has joined #RubyOnRails
[01:49:57] jxpx777: has joined #RubyOnRails
[01:50:37] dnewkerk: Radar: awesome, can???t wait to try Sidekiq more (I started out and mostly have experience with Resque so far, but not stuck on anything). Cool I???ll check it out
[01:50:39] Radar: I'll be using upstart to run a unicorn process and a sidekiq process
[01:50:42] paulcsmith: has joined #RubyOnRails
[01:51:28] nya: has joined #RubyOnRails
[01:51:34] dnewkerk: thanks to the wonders of ActiveJob, I have no jobs to rewrite if I switch :D
[01:52:25] x-light: hello mr Radar sir, does your deploy mean that you'll be using twist to review MTWR II....?
[01:52:32] Radar: x-light: yup yup
[01:52:54] Limix: has joined #RubyOnRails
[01:53:00] x-light: cool no more handwritten notes for me :)
[01:53:31] Radar: Gave it a new paintjob this week http://i.imgur.com/e4D5N3X.png
[01:54:01] x-light: oh that's nice
[01:56:41] x-light: Radar: so just give me a login when you've deployed it and I can add some stuff!
[01:56:43] dnewkerk: when you write a background job, is it best to write it assuming the adapter (e.g. sidekiq) will be working, or do you write any kind of exception handling within the job in case sidekiq has crashed, started up wrong, or something? Reason I ask is when I deployed my test app to production, I hadn???t yet correctly configured redis/resque and so my jobs failed silently. When my boss noticed this he wanted me to add except
[01:56:44] dnewkerk: handling in case it happens again
[01:56:51] Radar: x-light: will do
[01:56:59] Radar: dnewkerk: I assume that it works.
[01:58:02] dnewkerk: Radar: cool yeah I figured that would likely be the case, especially since once I correctly configured an initializer for redis and resque, my deploy would fail anyhow if it was still setup wrong
[02:01:57] FailBit: has joined #RubyOnRails
[02:02:21] Limix: has joined #RubyOnRails
[04:33:36] helpa: has joined #RubyOnRails
[04:34:01] Pupeno: has joined #RubyOnRails
[04:39:12] rushed: has joined #RubyOnRails
[04:39:28] nya: has joined #RubyOnRails
[04:41:32] nahtnam: Are there any convention for multi-word models? Like I want to create a model called "valve stats weapons" (singular or plural "weapon")? and "valve stats last matches" (singular or plural)?
[04:41:50] lemur: has joined #RubyOnRails
[04:42:21] nya: has joined #RubyOnRails
[04:43:32] christiandsg: has joined #RubyOnRails
[04:47:38] rushed: nahtnam: models are singular, the tables are plural
[04:47:48] jtthedev: Is it possible to download all available gems and keep create a local gem repo that your app can pull from I'm flying out to india tomorrow for a business trip, will not have network access for a while. i'm making as much local copies of everything as i can
[04:47:56] michaelrau: has joined #RubyOnRails
[04:48:09] jtthedev: or, is there a way, that I can move a gem from one app to another, where I can create an app that will have every possible gem I might need i don't want to fill the project i am going to be working on with gems. but if i need to add one, want to have a quick way to do so
[04:48:21] rushed: jtthedev: once you run bundle you'll have them local
[04:48:49] jtthedev: so if bundle on app A, and then want to add to app B
[04:48:55] jtthedev: i will be okay without network access ?
[04:49:08] rushed: jtthedev: no
[04:49:42] bkxd: has joined #RubyOnRails
[04:51:04] rushed: jtthedev: if you have a version that will fulfill the dependencies of B already then you can "bundle install --local"
[04:51:23] nahtnam: rushed: So I would do `rails g model ValveStatsWeapon`? That sounds kinda awkward. Is stats supposed to singular as well?
[04:51:34] rushed: jtthedev: but what was needed for A might not be the same, hard to say :)
[04:52:03] rushed: nahtnam: what is it?
[04:52:17] Maletor: has joined #RubyOnRails
[04:52:18] nahtnam: The model?
[04:52:24] wldcordeiro__: has joined #RubyOnRails
[04:52:24] rushed: nahtnam: yes
[04:52:28] nahtnam: It stores weapon stats from the valve api
[04:54:26] nya: has joined #RubyOnRails
[04:54:58] rushed: nahtnam: you can add it as uncountable in the inflections initilizer
[04:55:21] rushed: nahtnam: if you want to use WeaponStats (model) & weapon_stats (table)
[04:55:52] craysiii: has joined #RubyOnRails
[04:57:16] nya: has joined #RubyOnRails
[04:57:36] theery: has joined #RubyOnRails
[05:04:53] lipoqil: has joined #RubyOnRails
[05:05:04] sinaef: has joined #RubyOnRails
[05:05:36] riotjones: has joined #RubyOnRails
[05:10:24] nahtnam: rushed: Works! Thanks
[05:10:56] nahtnam: So in my Weapons model, I am defining different types of guns, like M4, AK47, Famas, etc. Does rails have a way to get the first of every gun?
[05:11:09] nya: has joined #RubyOnRails
[05:11:18] nahtnam: and by first, I mean get the most recent for the certain user
[05:11:27] nahtnam: and every gun entry
[05:11:30] nahtnam: if that makes any sense
[05:11:35] DoctorMonocular: has joined #RubyOnRails
[05:12:17] nya: has joined #RubyOnRails
[05:12:23] nahtnam: Let me rephrase that. Select the most recent entry of every single weapon that belongs to the user.
[05:14:59] yashinbasement: has joined #RubyOnRails
[05:17:08] nahtnam: Is this the proper solution I am looking for? http://stackoverflow.com/questions/21289319/how-to-get-the-latest-record-from-each-group-in-activerecord
[05:18:32] Rubie: has joined #RubyOnRails
[05:20:02] drale2k: has joined #RubyOnRails
[05:21:22] jxpx777: has joined #RubyOnRails
[05:24:28] nya: has joined #RubyOnRails
[05:27:19] nya: has joined #RubyOnRails
[05:28:59] annlewis: has joined #RubyOnRails
[05:29:42] banjara: has joined #RubyOnRails
[05:36:56] sevenseacat: has joined #RubyOnRails
[05:39:27] nya: has joined #RubyOnRails
[05:40:51] maz-dev: has joined #RubyOnRails
[05:41:02] workmad3: has joined #RubyOnRails
[05:43:26] charliesome: has joined #RubyOnRails
[05:47:58] charliesome: has joined #RubyOnRails
[05:48:36] dudo: has joined #RubyOnRails
[05:52:56] brockeaux: has joined #RubyOnRails
[05:54:23] tvw: has joined #RubyOnRails
[05:56:37] code1o6: has joined #RubyOnRails
[06:00:03] stardiviner: has joined #RubyOnRails
[06:00:24] jholm: has joined #RubyOnRails
[06:02:29] qejk: has joined #RubyOnRails
[06:06:01] Belle: has joined #RubyOnRails
[06:09:15] chipotle: has joined #RubyOnRails
[06:13:20] arup_r: has joined #RubyOnRails
[06:16:59] jeadre: has joined #RubyOnRails
[06:18:29] helpa: has joined #RubyOnRails
[06:20:16] charliesome: has joined #RubyOnRails
[06:21:07] drale2k: has joined #RubyOnRails
[06:21:32] jxpx777: has joined #RubyOnRails
[06:22:25] srinidhi: has joined #RubyOnRails
[06:24:24] tknz: has joined #RubyOnRails
[06:27:05] johnflux: has joined #RubyOnRails
[06:27:06] johnflux: has joined #RubyOnRails
[06:27:31] lxsameer: has joined #RubyOnRails
[06:29:12] Mendenhall: has joined #RubyOnRails
[06:29:46] annlewis: has joined #RubyOnRails
[06:31:43] gibre: has joined #RubyOnRails
[06:32:16] arup_r: today no body write code rails it seems....... :)
[06:32:35] sevenseacat: well it is saturday
[06:33:04] arup_r: don't we do weekend work ?
[06:33:57] bruno-: has joined #RubyOnRails
[06:34:35] ecnalyr: has joined #RubyOnRails
[06:37:45] GnuYawk: has joined #RubyOnRails
[06:38:30] bronson: has joined #RubyOnRails
[06:40:42] arup_r: good u r lucky then.
[06:40:51] robbyoconnor: has joined #RubyOnRails
[06:43:02] kshah: has joined #RubyOnRails
[06:45:12] kshah: I???m at my wits end, I think I???ve been battling ActiveRecord for a solid day now??? I can???t prevent AR from threading my script and causing key violations, or, duplicate entries when I remove the unique constraints. I have a connection pool of 1. I am NOT marked as threadsafe. It does not matter whether I use MySQL or postgres, I have non-stop build up off dead connections. The reaping_frequency option appears to be doing nothing. Us
[06:45:13] kshah: the threadpool and checking connections in and out doesn???t prevent the build up
[06:46:09] rhizome: i see hints that you might be overconfigured. is this a vanilla rails app in general?
[06:46:15] kshah: this is not Rails
[06:46:20] kshah: I???m using ONLY ActiveRecord
[06:46:23] Kilo`byte: has joined #RubyOnRails
[06:46:59] kshah: I???m taking data from redis, putting into CSV and into SQL at the same time
[06:47:13] sevenseacat: kshah: codeeeee?
[06:47:21] sevenseacat: and error? or are you just ranting?
[06:47:24] kshah: I have 0 threading written by me and 0 forking
[06:47:24] rhizome: yeah, gist yo shiz
[06:47:30] Ropeney: has joined #RubyOnRails
[06:47:31] kshah: one second
[06:48:57] nya: has joined #RubyOnRails
[06:50:30] jyraff: has joined #RubyOnRails
[06:50:42] lipoqil: has joined #RubyOnRails
[06:52:47] kshah: nvm??? I don???t see how anyone can help me??? something is super broken in AR pooling if you???re not letting Rails manage the pool
[06:53:14] kshah: I see tons and tons of evidence pointing to this on GH issues but no one seems to be able to track this down
[06:53:17] atomic: has joined #RubyOnRails
[06:53:27] helpa: TROLL DETECTED!
[06:53:36] kshah: i???m literally iterating over a giant hash and putting it???s contents into a db
[06:53:41] Radar: kshah: !rule0
[06:53:41] helpa: kshah: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us.
[06:53:43] sevenseacat: ok, so you're just ranting.
[06:53:49] Radar: Hm, weird that helpa is not responding.
[06:53:53] rhizome: http://stackoverflow.com/questions/27594300/how-to-use-activerecord-outside-rails
[06:53:58] sevenseacat: ACTION ignores
[06:54:25] Radar: !botsnack
[06:54:25] helpa: Nom nom. Thanks, Radar!
[06:54:48] baweaver: You dun broke it
[06:54:51] Radar: !botsnack
[06:54:51] helpa: Nom nom. Thanks, Radar!
[06:54:57] Radar: It hadn't authenticated with nickserv.
[06:55:28] Radar: kshah: !rule0
[06:55:28] helpa: kshah: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us.
[07:00:36] naftilos76: has joined #RubyOnRails
[07:03:09] nya: has joined #RubyOnRails
[07:04:24] nya: has joined #RubyOnRails
[07:05:08] x-light: has joined #RubyOnRails
[07:06:07] nkr: has joined #RubyOnRails
[07:09:27] nya: has joined #RubyOnRails
[07:10:03] nya: has joined #RubyOnRails
[07:10:19] dogweather: has joined #RubyOnRails
[07:11:08] dnewkerk: has joined #RubyOnRails
[07:11:33] nyaa: has joined #RubyOnRails
[07:12:55] jenrzzz: has joined #RubyOnRails
[07:17:12] towski_: has joined #RubyOnRails
[07:18:46] yfeldblum: has joined #RubyOnRails
[07:19:16] tknz: has joined #RubyOnRails
[07:20:54] bluish: has joined #RubyOnRails
[07:21:01] yfeldblum: has joined #RubyOnRails
[07:22:17] drale2k: has joined #RubyOnRails
[07:22:56] krz: has joined #RubyOnRails
[07:23:30] jenrzzz: has joined #RubyOnRails
[07:28:21] sinkensabe: has joined #RubyOnRails
[07:29:54] workmad3: has joined #RubyOnRails
[07:30:32] annlewis: has joined #RubyOnRails
[07:30:57] maz-dev: has joined #RubyOnRails
[07:36:05] yfeldblum: has joined #RubyOnRails
[07:40:09] sininen: has joined #RubyOnRails
[07:40:09] sandstrom: has joined #RubyOnRails
[07:40:15] sjuxax: has joined #RubyOnRails
[07:41:14] sjuxax: I want to have a function in my model that adds a where clause to a query and is chainable. e.g., if the function is named x, I want to do MyModel.where(a: b).x(c), and I want x to add a where clause to this query. How can I make that happen?
[07:42:37] darutoko: has joined #RubyOnRails
[07:43:10] sevenseacat: def self.x(c); where(whatever); end ?
[07:43:29] sevenseacat: or a named scope
[07:45:07] kshah: has left #RubyOnRails: ()
[07:45:44] jgt: has joined #RubyOnRails
[07:45:45] sjuxax: sevenseacat: OK, thanks. I should've guessed I could just call where directly.
[07:48:14] jxpx777: has joined #RubyOnRails
[07:49:01] jholm: has joined #RubyOnRails
[07:49:40] bruno-: has joined #RubyOnRails
[07:56:36] yaewa: has joined #RubyOnRails
[07:56:44] quazimodo: has joined #RubyOnRails
[07:58:59] AzaToth: has joined #RubyOnRails
[08:01:44] maz-dev: has joined #RubyOnRails
[08:02:24] dionysus69: has joined #RubyOnRails
[08:05:12] bruno-: has joined #RubyOnRails
[08:11:11] jgt1: has joined #RubyOnRails
[08:11:57] jondot: has joined #RubyOnRails
[08:23:16] drale2k: has joined #RubyOnRails
[08:23:47] Pazician: has joined #RubyOnRails
[08:23:52] arooni-mobile: has joined #RubyOnRails
[08:25:00] roxtrongo: has joined #RubyOnRails
[08:25:25] lipoqil: has joined #RubyOnRails
[08:28:09] DEA7TH: has joined #RubyOnRails
[08:30:11] yfeldblum: has joined #RubyOnRails
[08:31:19] annlewis: has joined #RubyOnRails
[08:32:03] Pazician: has joined #RubyOnRails
[08:37:42] gaussblurinc1: has joined #RubyOnRails
[08:42:33] rattatmatt: has joined #RubyOnRails
[08:45:49] Depili: has joined #RubyOnRails
[08:46:20] DoubleMalt: has joined #RubyOnRails
[08:46:30] jaequery: has joined #RubyOnRails
[08:58:24] stamina: has joined #RubyOnRails
[09:02:34] Pupeno: has joined #RubyOnRails
[09:03:27] nya: has joined #RubyOnRails
[09:04:47] yfeldblum: has joined #RubyOnRails
[09:07:59] voker57: has joined #RubyOnRails
[09:13:40] beauby: has joined #RubyOnRails
[09:15:12] lipoqil: has joined #RubyOnRails
[09:17:24] rushed: has joined #RubyOnRails
[09:18:28] michael_mbp: has joined #RubyOnRails
[09:18:48] workmad3: has joined #RubyOnRails
[09:21:38] yfeldblum: has joined #RubyOnRails
[09:22:48] michael_mbp: has joined #RubyOnRails
[09:24:25] drale2k: has joined #RubyOnRails
[09:30:33] tsujp: has joined #RubyOnRails
[09:32:04] annlewis: has joined #RubyOnRails
[09:34:42] drunkdad: has joined #RubyOnRails
[09:36:23] jxpx777: has joined #RubyOnRails
[09:37:20] jholm: has joined #RubyOnRails
[09:39:57] DLSteve: has joined #RubyOnRails
[09:40:28] bronson: has joined #RubyOnRails
[09:46:45] krz: has joined #RubyOnRails
[09:47:33] saneki: has joined #RubyOnRails
[09:48:27] finnnnnnnnnnn: has joined #RubyOnRails
[09:49:45] startupality: has joined #RubyOnRails
[09:50:06] finnnnnnnnnnn: I???m going to change a has_and_belongs_to_many to a has_many through relationship. Is my first step to remove the many to many join table and related indexes?
[09:51:55] lipoqil: finnnnnnnnnnn: What is your goal?
[09:52:31] finnnnnnnnnnn: I have a user model and a competition model, they currently have a has_and_belongs_to_many relationship.
[09:52:42] finnnnnnnnnnn: I want add an entry model
[09:52:54] finnnnnnnnnnn: to add properties to that relationship
[09:54:03] rushed: finnnnnnnnnnn: add an id + whatever else you want to the existing join table?
[09:54:15] rushed: finnnnnnnnnnn: (and give it a real name)
[09:54:33] naftilos76: has joined #RubyOnRails
[09:55:02] maz-dev: has joined #RubyOnRails
[09:55:45] lipoqil: finnnnnnnnnnn: And what is in entry model?
[09:56:47] nya: has joined #RubyOnRails
[09:56:57] finnnnnnnnnnn: lipoqil: the entry model would have the details the user has used to enter a competition - their answer to the competition questions.
[09:58:27] lipoqil: finnnnnnnnnnn: I would vote for keeping the habtm in place and add another relationships from both user and competition
[09:58:37] finnnnnnnnnnn: this is the join table from the current schema. if I decide to edit that table do I need to remove the id: false
[09:58:42] finnnnnnnnnnn: https://gist.github.com/anonymous/3e101e317beda91caccd
[09:58:48] finnnnnnnnnnn: (thanks everyone)
[09:59:10] romdi: has joined #RubyOnRails
[09:59:47] lipoqil: finnnnnnnnnnn: You should always have id in your table
[10:01:07] lipoqil: finnnnnnnnnnn: https://railsforum.com/topic/332-how-to-add-additional-attributes-to-the-join-table-in-habtm-and-fetch-that-when-getting-association-values/?p=1003
[10:01:15] finnnnnnnnnnn: lipoqil: amazing
[10:01:20] lipoqil: finnnnnnnnnnn: This is the way to go I guess
[10:01:41] Leak: has joined #RubyOnRails
[10:08:17] nyaa: has joined #RubyOnRails
[10:11:13] ecnalyr: has joined #RubyOnRails
[10:19:19] workmad3: has joined #RubyOnRails
[10:20:29] codenapper: has joined #RubyOnRails
[10:22:45] arsim: has joined #RubyOnRails
[10:23:01] mrbubbles: has joined #RubyOnRails
[10:24:35] arsim: how can i assign two foreign keys in ROR
[10:25:31] drale2k: has joined #RubyOnRails
[10:27:01] enkristoffer: has joined #RubyOnRails
[10:30:55] Grundell: has joined #RubyOnRails
[10:32:51] annlewis: has joined #RubyOnRails
[10:34:28] arup_r: arsim: Write this http://apidock.com/rails/v4.2.1/ActiveRecord/ConnectionAdapters/SchemaStatements/add_reference 2 times in your migration file and apply it
[10:34:46] lipoqil: arsim: What do you mean by assigning? Have them in table scheme after running migrations?
[10:36:35] Kallis: has joined #RubyOnRails
[10:36:45] michaelrau: has joined #RubyOnRails
[10:45:44] codenapper: has joined #RubyOnRails
[10:48:22] charliesome: has joined #RubyOnRails
[10:50:33] nya: has joined #RubyOnRails
[10:50:35] yfeldblum: has joined #RubyOnRails
[11:00:47] jsrn_: has joined #RubyOnRails
[11:02:05] yfeldblum: has joined #RubyOnRails
[11:02:20] bkxd: has joined #RubyOnRails
[11:03:33] allcentury: has joined #RubyOnRails
[11:05:47] moei: has joined #RubyOnRails
[11:06:21] riotjones: has joined #RubyOnRails
[11:07:43] DoctorMonocular: has joined #RubyOnRails
[11:08:17] arsim: i want to assign foreign keys in two field of one table
[11:09:18] michaelrau: has joined #RubyOnRails
[11:17:37] karol: has joined #RubyOnRails
[11:25:35] jholm: has joined #RubyOnRails
[11:26:06] codenapper: arsim, have a look at http://guides.rubyonrails.org/active_record_migrations.html#foreign-keys
[11:26:15] nya: has joined #RubyOnRails
[11:26:32] karol: has joined #RubyOnRails
[11:26:36] drale2k: has joined #RubyOnRails
[11:32:47] arsim: codenapper: thats for one foreign key
[11:32:57] arsim: it doesnt tell for two foreign keys
[11:33:31] arsim: authors_id u name the field like this and rials takes it automatically as foreign key
[11:33:46] arsim: but what if i have another field that i want to assign foreign key
[11:33:47] annlewis: has joined #RubyOnRails
[11:33:58] sevenseacat: has joined #RubyOnRails
[11:33:59] arsim: i cant make double "author_id" name
[11:37:29] codenapper: arsim, ah, you're right. doesn't seem to be trivial. if you haven't stumbled across it already, http://blog.pivotal.io/labs/labs/rails-associations-with-multiple-foreign-keys might be a start. but i didn't come across this scenario, yet, so i don't have much help to offer
[11:38:38] arup_r1: has joined #RubyOnRails
[11:39:28] arsim: thanks anyway codenapper
[11:44:24] arup_r1: has joined #RubyOnRails
[11:49:53] tknz: has joined #RubyOnRails
[11:50:49] atzorvas: has joined #RubyOnRails
[11:52:38] kjung: has joined #RubyOnRails
[11:54:32] krz: has joined #RubyOnRails
[11:57:24] tsujp: has joined #RubyOnRails
[11:57:43] acti0nman: has joined #RubyOnRails
[12:09:50] kjung: has joined #RubyOnRails
[12:12:16] workmad3: has joined #RubyOnRails
[12:17:38] jondot: has joined #RubyOnRails
[12:18:53] ktchup: has joined #RubyOnRails
[12:18:59] arup_r: has joined #RubyOnRails
[12:19:07] shinmaruko: has joined #RubyOnRails
[12:21:50] Wingar: has joined #RubyOnRails
[12:27:19] allcentury: has joined #RubyOnRails
[12:27:34] raluxgaza: has joined #RubyOnRails
[12:27:44] drale2k: has joined #RubyOnRails
[12:28:27] nya: has joined #RubyOnRails
[12:28:29] raluxgaza: Is there an alternative way to crop images in rails other than railscast 182?
[12:30:43] fast_scooter: has joined #RubyOnRails
[12:34:24] annlewis: has joined #RubyOnRails
[12:36:03] maz-dev: has joined #RubyOnRails
[12:37:48] arup_r: you mean image resize ?
[12:38:41] kjung: has joined #RubyOnRails
[12:40:33] roxtrongo: has joined #RubyOnRails
[12:40:47] fast_scooter: has joined #RubyOnRails
[12:41:45] andywww: has joined #RubyOnRails
[12:46:13] centrx: has joined #RubyOnRails
[12:46:41] Guest81018: has joined #RubyOnRails
[12:46:51] stamina: has joined #RubyOnRails
[12:47:01] j0llyr0tten: has joined #RubyOnRails
[12:47:33] sameerynho: has joined #RubyOnRails
[12:48:27] j0llyr0tten: hello, in Sprockets 3.X there is a method register_engine - I can't find it in Sprockets 4.X - how do we register extensions in Rails Edge?
[12:48:53] sankaber: has joined #RubyOnRails
[12:52:57] The_Phoenix: has joined #RubyOnRails
[13:01:33] fast_scooter: has joined #RubyOnRails
[13:08:23] DoctorMonocular: has joined #RubyOnRails
[13:08:24] meatherly: has joined #RubyOnRails
[13:11:36] hackeron: has joined #RubyOnRails
[13:13:43] jholm: has joined #RubyOnRails
[13:15:46] joshkovach: has joined #RubyOnRails
[13:17:36] cntrx: has joined #RubyOnRails
[13:17:48] dionysus69: has joined #RubyOnRails
[13:18:39] atomical: has joined #RubyOnRails
[13:23:57] eyck: has joined #RubyOnRails
[13:24:07] drupald: has joined #RubyOnRails
[13:24:08] crankharder: has joined #RubyOnRails
[13:24:10] hardtail: has joined #RubyOnRails
[13:24:16] cajone: has joined #RubyOnRails
[13:24:18] andatche: has joined #RubyOnRails
[13:24:20] jso: has joined #RubyOnRails
[13:24:26] Dopagod: has joined #RubyOnRails
[13:24:27] ebbflowgo: has joined #RubyOnRails
[13:24:27] michaellippold: has joined #RubyOnRails
[13:25:09] jeadre: has joined #RubyOnRails
[13:25:13] xhoy: has joined #RubyOnRails
[13:25:13] lea: has joined #RubyOnRails
[13:25:17] redondo: has joined #RubyOnRails
[13:25:19] Olipro: has joined #RubyOnRails
[13:25:27] earthquake: has joined #RubyOnRails
[13:25:38] hahuang61: has joined #RubyOnRails
[13:25:40] chrishough: has joined #RubyOnRails
[13:25:45] finnnnnnnnnnn: has joined #RubyOnRails
[13:25:55] sparr: has joined #RubyOnRails
[13:25:57] bphogan: has joined #RubyOnRails
[13:26:02] coffeejunk: has joined #RubyOnRails
[13:26:29] borkdude: has joined #RubyOnRails
[13:27:28] naftilos76: has joined #RubyOnRails
[13:27:34] RTG`: has joined #RubyOnRails
[13:28:36] alxndr: has joined #RubyOnRails
[13:28:51] drale2k: has joined #RubyOnRails
[13:29:20] nahtnam: has joined #RubyOnRails
[13:30:16] mist: has joined #RubyOnRails
[13:31:16] hellschreiber: has joined #RubyOnRails
[13:31:30] herpless: has joined #RubyOnRails
[13:31:55] mostlybadfly: has joined #RubyOnRails
[13:34:08] kies^: has joined #RubyOnRails
[13:34:57] Meow-J: has joined #RubyOnRails
[13:35:06] server2client: has joined #RubyOnRails
[13:35:10] annlewis: has joined #RubyOnRails
[13:39:25] sever2client: has joined #RubyOnRails
[13:41:48] meatherly: has joined #RubyOnRails
[13:44:27] maz-dev: has joined #RubyOnRails
[13:45:29] joshkovach: has joined #RubyOnRails
[13:47:19] fast_scooter: has joined #RubyOnRails
[13:48:20] gibre: has joined #RubyOnRails
[13:56:57] pulgalipe: has joined #RubyOnRails
[14:01:15] udiudi: has joined #RubyOnRails
[14:02:43] udiudi: has left #RubyOnRails: ()
[14:03:44] victortyau: has joined #RubyOnRails
[14:03:45] n1lo: has joined #RubyOnRails
[14:04:45] zpe: has joined #RubyOnRails
[14:10:28] meatherly: has joined #RubyOnRails
[14:10:59] DCameronMauch: has joined #RubyOnRails
[14:11:12] havenwood: has joined #RubyOnRails
[14:11:15] DCameronMauch: has left #RubyOnRails: ()
[14:12:52] AliasLStoRM: has joined #RubyOnRails
[14:15:48] SteenJobs: has joined #RubyOnRails
[14:24:14] DoctorMonocular: has joined #RubyOnRails
[14:29:54] drale2k: has joined #RubyOnRails
[14:32:55] netzfisch: has joined #RubyOnRails
[14:35:28] theery: has joined #RubyOnRails
[14:35:56] annlewis: has joined #RubyOnRails
[14:36:46] maz-dev: has joined #RubyOnRails
[14:38:34] bruno-: has joined #RubyOnRails
[14:40:51] tsujp: has joined #RubyOnRails
[14:52:17] Dzejmskrokan: has joined #RubyOnRails
[14:55:20] krz: has joined #RubyOnRails
[15:01:02] Pupeno: has joined #RubyOnRails
[15:02:03] jholm: has joined #RubyOnRails
[15:03:30] theery: has joined #RubyOnRails
[15:05:09] northfurr: has joined #RubyOnRails
[15:06:51] Axilla: i'm working on using split/splitrb to do some a/b testing on an app
[15:07:17] Axilla: i have a question about how it does the tests.. it seems to e working, but it appears to show the test everytime and when I few the dashboard it says "needs 30 participants"
[15:07:25] Axilla: does this mean it will show it 30 times then show the "control" 30 times?
[15:07:30] Axilla: back and forth? or is it random?
[15:09:20] givanse: has joined #RubyOnRails
[15:10:55] bruno-: has joined #RubyOnRails
[15:12:28] strcmp1: has joined #RubyOnRails
[15:13:57] tsujp: has joined #RubyOnRails
[15:22:31] bluish: has joined #RubyOnRails
[15:24:36] kegan_: has joined #RubyOnRails
[15:24:55] Lightsword: has joined #RubyOnRails
[15:24:57] DoctorMonocular: has joined #RubyOnRails
[15:26:34] Axilla: nevermind found my answer
[15:30:27] banjara: has joined #RubyOnRails
[15:31:02] drale2k: has joined #RubyOnRails
[15:32:19] northfurr_: has joined #RubyOnRails
[15:32:31] maz-dev: has joined #RubyOnRails
[15:32:41] pontiki: has joined #RubyOnRails
[15:35:34] ecnalyr: has joined #RubyOnRails
[15:36:38] Pupeno_: has joined #RubyOnRails
[15:36:52] annlewis: has joined #RubyOnRails
[15:39:01] alejo_: has joined #RubyOnRails
[15:44:54] exadeci: has joined #RubyOnRails
[15:45:23] JBrickley: has joined #RubyOnRails
[15:47:29] Glyphik: has joined #RubyOnRails
[15:49:40] Pupeno: has joined #RubyOnRails
[15:52:05] rogue_koder: has joined #RubyOnRails
[15:57:23] JBrickley: has joined #RubyOnRails
[15:57:53] Glyphik: Is there a way to place a conditional within a form_for helper that will set a value in a hidden field based upon which radio button was selected in the form?
[15:58:51] meatherly: has joined #RubyOnRails
[15:59:51] arup_r: Glyphik: Possible but using JS
[16:04:48] Lightsword_: has joined #RubyOnRails
[16:08:16] Llama4146: has joined #RubyOnRails
[16:09:09] Sylario: has joined #RubyOnRails
[16:09:31] JBrickley: has joined #RubyOnRails
[16:15:44] stamina: has joined #RubyOnRails
[16:15:51] gambl0re: controller names are plural, model names singular?
[16:20:02] mostlybadfly: has joined #RubyOnRails
[16:20:55] Pupeno: has joined #RubyOnRails
[16:25:34] ngscheurich: has joined #RubyOnRails
[16:28:08] corioliss: has joined #RubyOnRails
[16:29:08] sever2client: has joined #RubyOnRails
[16:29:08] arup_r: gambl0re: yes
[16:32:07] drale2k: has joined #RubyOnRails
[16:34:06] centrx: has joined #RubyOnRails
[16:34:30] jaequery: has joined #RubyOnRails
[16:37:27] annlewis: has joined #RubyOnRails
[16:39:43] northfurr: has joined #RubyOnRails
[16:42:31] devdazed: has joined #RubyOnRails
[16:42:53] iateadonut: has joined #RubyOnRails
[16:44:20] JBrickley: has joined #RubyOnRails
[16:44:49] Lightsword: has joined #RubyOnRails
[16:46:04] christiandsg: has joined #RubyOnRails
[16:46:56] dudo: has joined #RubyOnRails
[16:50:35] jholm: has joined #RubyOnRails
[16:56:33] Dzejmskrokan: has joined #RubyOnRails
[16:57:32] sever2client: has joined #RubyOnRails
[17:02:00] nickiiiii: has joined #RubyOnRails
[17:06:07] BongoShaftsbury: has joined #RubyOnRails
[17:06:21] Swappticon: has joined #RubyOnRails
[17:06:34] nickiiiii: this is the first time I have joined rubyandrails channel
[17:06:56] arup_r: welcome nickiiiii
[17:07:25] nickiiiii: thankyou! I am a beginner of rubywithrails. Just installed everything in ubuntu.. now I am ready to code.
[17:10:42] DoctorMonocular: has joined #RubyOnRails
[17:10:59] sever2client: make hello world app
[17:11:15] mblagden: has joined #RubyOnRails
[17:11:53] jcm: has joined #RubyOnRails
[17:16:51] baweaver: has joined #RubyOnRails
[17:18:03] nickiiiii: yeah i made the hello world app
[17:18:20] nickiiiii: i am trying to make more complex apps
[17:19:02] Exuma: has joined #RubyOnRails
[17:20:52] Exuma: has joined #RubyOnRails
[17:21:12] dionysus69: has joined #RubyOnRails
[17:23:14] meatherly: has joined #RubyOnRails
[17:24:12] Exuma: has joined #RubyOnRails
[17:24:23] meatherly: has joined #RubyOnRails
[17:25:18] DoubleMalt: has joined #RubyOnRails
[17:26:05] SteenJobs: has joined #RubyOnRails
[17:28:35] towski_: has joined #RubyOnRails
[17:28:51] bryancp: has left #RubyOnRails: ()
[17:29:39] Exuma: has joined #RubyOnRails
[17:32:04] Exuma: has joined #RubyOnRails
[17:32:50] Exuma: has joined #RubyOnRails
[17:33:14] drale2k: has joined #RubyOnRails
[17:33:49] WhereIsMySpoon: has left #RubyOnRails: ("http://quassel-irc.org - Chat comfortably. Anywhere.")
[17:38:12] annlewis: has joined #RubyOnRails
[17:45:17] DLSteve: has joined #RubyOnRails
[17:47:02] jondot: has joined #RubyOnRails
[17:49:10] Maletor: has joined #RubyOnRails
[17:50:20] sinkensabe: has joined #RubyOnRails
[17:50:53] otherj: has joined #RubyOnRails
[17:51:26] otherj: for those of you deploying with cap ... what's the preferred way to install bundler? should it already be on the server (with ansible etc), or should cap itself be installing it, or what?
[17:57:50] ktchup: has joined #RubyOnRails
[17:58:31] Motoservo: has joined #RubyOnRails
[18:01:55] VeryBewitching: has joined #RubyOnRails
[18:07:51] Dzejmskrokan: has joined #RubyOnRails
[18:08:07] dionysus69: has joined #RubyOnRails
[18:13:38] qejk: has joined #RubyOnRails
[18:18:35] zack6849: has joined #RubyOnRails
[18:19:07] theery: has joined #RubyOnRails
[18:19:21] zack6849: has joined #RubyOnRails
[18:21:03] hotpancakes: has joined #RubyOnRails
[18:22:07] greengriminal: has joined #RubyOnRails
[18:22:28] Scripore: has joined #RubyOnRails
[18:24:45] chipotle: has joined #RubyOnRails
[18:25:29] quazimodo: has joined #RubyOnRails
[18:25:37] hotpancakes: Quick question. Inside an integration test, I'm creating a user and then accessing that @user variable via assigns(:user). Why does assigns(:user) return nil after I create the user with a post_via_redirect? It works fine when submitting a standard post.
[18:27:52] theery_: has joined #RubyOnRails
[18:28:01] maz-dev: has joined #RubyOnRails
[18:31:15] beauby: has joined #RubyOnRails
[18:31:30] RedDwarf: has joined #RubyOnRails
[18:33:02] DoctorMonocular: has joined #RubyOnRails
[18:33:04] petricore: has joined #RubyOnRails
[18:34:23] drale2k: has joined #RubyOnRails
[18:34:59] SteenJobs: has joined #RubyOnRails
[18:38:39] qejk: has joined #RubyOnRails
[18:38:56] jholm: has joined #RubyOnRails
[18:38:58] annlewis: has joined #RubyOnRails
[18:41:11] devdazed: has joined #RubyOnRails
[18:41:35] fedexo: has joined #RubyOnRails
[18:42:25] hashrocket: has joined #RubyOnRails
[18:44:09] ght: Question: We're attempting to utilize a check_box_tag and the box being checked is successfully passing true, but when the box is unchecked nothing is passed, which is apparently an issue.
[18:44:48] ght: Assuming our check box tag is check_box_tag "Value", true, model.column
[18:44:55] darutoko-: has joined #RubyOnRails
[18:45:19] ght: What would the syntax be for passing true if checked and false if not? Note that we have to use check_box_tag, not f.check_box
[18:45:21] Swappticon: has joined #RubyOnRails
[18:45:50] rhizome: that is by design in HTML
[18:46:45] rhizome: you can use a hidden field as a workaround
[18:47:02] rhizome: you can also use a form builder instead
[18:55:52] ght: Good heavens we cannot get check_box_tag to work right with boolean values.
[18:58:29] netzfisch: has joined #RubyOnRails
[18:59:17] rhizome: with a hidden field?
[19:00:33] Zackio: has joined #RubyOnRails
[19:01:25] ght: Fixed it with the hidden_field_tag solution.
[19:02:33] Maletor: has joined #RubyOnRails
[19:04:01] ariedler: has joined #RubyOnRails
[19:07:15] mloy: has joined #RubyOnRails
[19:08:12] TankC: has joined #RubyOnRails
[19:08:16] nickiiiii: rails generate model Article title:string text:text
[19:08:27] nickiiiii: I forgot to add title:string
[19:08:32] nickiiiii: what should I do now?
[19:08:53] nickiiiii: I forgot to add that while generating model
[19:08:57] rhizome: add it to the migration
[19:08:57] VeryBewitching: nickiiiii: You can generate a migration.
[19:09:07] nickiiiii: db:migrate ?
[19:09:20] nickiiiii: rake db:migrate ?
[19:09:26] VeryBewitching: nickiiiii: Have you already run rake db:migrate ?
[19:09:40] VeryBewitching: Then you want to generate a migration
[19:09:47] nickiiiii: how to do that?
[19:09:50] rhizome: either rollback and edit or create a new migration
[19:10:03] nickiiiii: yeah but how?
[19:10:39] VeryBewitching: nickiiiii: http://edgeguides.rubyonrails.org/active_record_migrations.html
[19:11:03] nickiiiii: ok thankyou
[19:11:09] havenn: has joined #RubyOnRails
[19:12:25] ecnalyr: has joined #RubyOnRails
[19:12:40] christiandsg: has joined #RubyOnRails
[19:13:30] TankC: I've made an engine (let's say Foo) and a controller within that engine ( Foo::SessionsController < ApplicationController ). In my engine routes I have Foo::Engine.routes.draw { get '/bar', to: 'sessions#create' }.. and then I've mounted the engine in my app's router. It almost seems to work, but when I visit the /bar route, rails is looking for SessionController without the Foo namespace. I don't understand why?
[19:13:37] arup_r: ght: check_box_tag should work.. You probably couldn't make it work :)
[19:14:00] arup_r: wanna to give it a try one more time ?
[19:14:12] stamina: has joined #RubyOnRails
[19:14:15] Papierkorb: Is it possible to have differing routes for sub-domains? I want to use my.domain/ for user access, and api.my.domain/ for the JSON API
[19:15:13] arup_r: Papierkorb: can I pm you?
[19:15:27] Papierkorb: arup_r: No idea for what, but go ahead
[19:15:48] ktchup: has joined #RubyOnRails
[19:16:12] Papierkorb: Ah, the subdomain constraint. probably even does what its name suggests.
[19:16:22] Lightsword: has joined #RubyOnRails
[19:18:25] pawnbox: has joined #RubyOnRails
[19:19:35] chipotle: has joined #RubyOnRails
[19:23:48] michael_mbp: has joined #RubyOnRails
[19:23:52] null__: has joined #RubyOnRails
[19:23:59] vasilakisFiL: has joined #RubyOnRails
[19:24:02] cookiez: has joined #RubyOnRails
[19:24:11] bluish: has joined #RubyOnRails
[19:24:13] ddv: has joined #RubyOnRails
[19:24:23] bin_005_l: has joined #RubyOnRails
[19:24:24] null__: has joined #RubyOnRails
[19:25:19] ddv: has joined #RubyOnRails
[19:25:22] Zackio: has joined #RubyOnRails
[19:27:40] maz-dev: has joined #RubyOnRails
[19:35:23] drale2k: has joined #RubyOnRails
[19:36:05] bruno-: has joined #RubyOnRails
[19:39:02] finnnnnnnnnnn: has joined #RubyOnRails
[19:39:44] rodfersou: has joined #RubyOnRails
[19:39:56] annlewis: has joined #RubyOnRails
[19:41:33] maz-dev: has joined #RubyOnRails
[19:42:05] darrencauthon: has joined #RubyOnRails
[19:43:58] yfeldblum: has joined #RubyOnRails
[19:44:08] hotpancakes: has joined #RubyOnRails
[19:44:33] christiandsg: has joined #RubyOnRails
[19:44:49] fedexo: has joined #RubyOnRails
[19:45:06] Ergo: has joined #RubyOnRails
[19:45:30] Xiti: has joined #RubyOnRails
[19:51:14] Pupeno: has joined #RubyOnRails
[19:51:28] uris: has joined #RubyOnRails
[19:56:00] Caius: has joined #RubyOnRails
[19:56:11] sinkensabe: has joined #RubyOnRails
[19:56:37] bluish: has joined #RubyOnRails
[19:56:43] gambl0re: how do i create a logout button using devise?
[19:57:33] naftilos76: has joined #RubyOnRails
[19:58:24] beauby: has joined #RubyOnRails
[19:59:43] toretore: has joined #RubyOnRails
[20:00:52] erich: has joined #RubyOnRails
[20:01:29] arup_r: devise has default views.. see those pages... you will get the ideas
[20:02:07] tonios57: has joined #RubyOnRails
[20:02:15] marr: has joined #RubyOnRails
[20:06:36] helpa: TankC: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us.
[20:07:14] VeryBewitching: TankC: Make a gist of the engine, your routes.rb too
[20:10:44] gambl0re: are you talking to me?
[20:12:34] podman: has joined #RubyOnRails
[20:12:46] gambl0re: <%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
[20:13:13] rails539: has joined #RubyOnRails
[20:13:27] arup_r: So you got it gambl0re right
[20:14:39] d2dchat: has joined #RubyOnRails
[20:14:49] nogic: has joined #RubyOnRails
[20:17:18] Pupeno: has joined #RubyOnRails
[20:17:18] Pupeno: has joined #RubyOnRails
[20:18:53] dionysus69: has joined #RubyOnRails
[20:22:11] kegan_: has joined #RubyOnRails
[20:24:45] devdazed: has joined #RubyOnRails
[20:24:45] bronson: has joined #RubyOnRails
[20:25:28] dideler: has joined #RubyOnRails
[20:26:59] jholm: has joined #RubyOnRails
[20:30:00] jeadre: has joined #RubyOnRails
[20:33:22] MarkTR: has joined #RubyOnRails
[20:36:32] drale2k: has joined #RubyOnRails
[20:37:30] wfll: has joined #RubyOnRails
[20:39:10] wfll: has left #RubyOnRails: ()
[20:40:32] annlewis: has joined #RubyOnRails
[20:40:42] ildarsafin: has joined #RubyOnRails
[20:40:48] ebbflowgo: has joined #RubyOnRails
[20:41:59] bruno-: has joined #RubyOnRails
[20:43:25] bluish: has joined #RubyOnRails
[20:45:32] hotpancakes: has joined #RubyOnRails
[20:53:44] darrencauthon: has joined #RubyOnRails
[20:54:13] atomical: has joined #RubyOnRails
[20:56:57] bronson: has joined #RubyOnRails
[20:57:49] SteenJobs: has joined #RubyOnRails
[21:02:23] DLSteve: has joined #RubyOnRails
[21:05:26] dudo: has joined #RubyOnRails
[21:08:52] sarink: has joined #RubyOnRails
[21:09:25] bin_005: has joined #RubyOnRails
[21:11:04] ruurd: has joined #RubyOnRails
[21:11:05] shinnya: has joined #RubyOnRails
[21:12:20] hck89: has joined #RubyOnRails
[21:14:01] MartinElvar: has joined #RubyOnRails
[21:17:14] sargas: has joined #RubyOnRails
[21:17:54] Maletor: has joined #RubyOnRails
[21:20:21] robbyoconnor: has joined #RubyOnRails
[21:27:04] roxtrongo: has joined #RubyOnRails
[21:30:50] hueston: has joined #RubyOnRails
[21:31:31] hueston: hey guys, anyone recommend a decent guide for a beginner at rails
[21:32:01] sinkensabe: has joined #RubyOnRails
[21:32:04] hueston: theres a few things on youtube but they arent very indepth
[21:32:09] AntiSpamMeta: has joined #RubyOnRails
[21:34:20] Mendenhall: has joined #RubyOnRails
[21:34:42] rodfersou: has joined #RubyOnRails
[21:35:04] maz-dev: has joined #RubyOnRails
[21:35:24] asi_: has joined #RubyOnRails
[21:35:53] AntiSpamMeta: has joined #RubyOnRails
[21:35:57] northfurr: has joined #RubyOnRails
[21:36:21] voltalio: has joined #RubyOnRails
[21:36:22] Papierkorb: hueston: Welcome to IRC, where patience pays off. Read the rails guides, they're pretty good. the beginner tutorial builds a blog
[21:36:45] voltalio: has joined #RubyOnRails
[21:37:23] cornerma1: has joined #RubyOnRails
[21:37:36] drale2k: has joined #RubyOnRails
[21:38:09] AntiSpamMeta: has joined #RubyOnRails
[21:39:34] ruurd: that + start doing it + use a proper IDE that understands what you're doing.
[21:40:46] cashnguns: has joined #RubyOnRails
[21:40:50] dlitz: has joined #RubyOnRails
[21:41:16] annlewis: has joined #RubyOnRails
[21:42:17] hueston: ruurd, so you wouldnt recommend sublime?
[21:42:37] blokc: has joined #RubyOnRails
[21:43:28] Papierkorb: Sublime is fine, there is actually only one real IDE out there for ruby
[21:43:38] blokc: wanted to share a script I wrote that translate rails internationalization yaml files using termit gem.
[21:43:39] blokc: https://github.com/wurde/script/blob/master/comm/translate_yaml.rb
[21:43:41] Lightsword: has joined #RubyOnRails
[21:43:48] hueston: Papierkorb, thank you :) could you drop me a link to the one you are referring to?
[21:43:59] Papierkorb: hueston: http://guides.rubyonrails.org/
[21:44:14] hueston: Papierkorb, cheers :)
[21:44:15] VeryBewitching: blokc: You should setup a gem and rake task :D
[21:44:41] VeryBewitching: blokc: I had thought of doing that when sevenseacat linked that gem the other day.
[21:45:14] Papierkorb: auto translation?
[21:45:43] blokc: @papierkorb I wouldn't recommend it as an end solution, but the beginning of your 18n efforts
[21:45:45] VeryBewitching: Papierkorb: You should checkout the termit gem
[21:46:04] Papierkorb: German here. Please give me an option, a good visible one, to switch to english so I don't have to figure out what everything is trying to tell me
[21:46:05] blokc: it uses google translate api.
[21:46:07] VeryBewitching: blokc: Ya, it's good to get something workable for I18n
[21:46:55] Papierkorb: VeryBewitching: heh, there was a guy in #ruby an hour or so ago who had trouble using GTranslate API. Maybe s/he would appreciate that gem ..
[21:47:18] VeryBewitching: Papierkorb: I played with it yesterday for a bit and it works rather well imo
[21:47:52] VeryBewitching: blokc: A handler for interpolated values in YAML strings would be handy in your script.
[21:48:05] blokc: It's not perfect, some of the strings getting passed in are throwing system errors and I just ignore those.
[21:48:11] VeryBewitching: blokc: key: "Something with %{placeholder} in it"
[21:48:14] hueston: Papierkorb, were you referring to the Aptana ide/
[21:48:58] Lightsword: has joined #RubyOnRails
[21:49:01] Papierkorb: hueston: RubyMine by the IntelliJ guys. Never tried Aptana, it doesn't work on Arch without hacks -.-
[21:49:05] julio_menendez: has joined #RubyOnRails
[21:49:30] VeryBewitching: hueston: I've tried Aptana for Rails, wasn't impressed really. I use RubyMine now.
[21:51:23] Papierkorb: Then I mistook aptana for another IDE which was written in pure ruby. Aptana never worked for me either though. Atom also hates me, and is laggy, so I went back to my favorite general purpose text editor
[21:52:01] roxtrongo: has joined #RubyOnRails
[21:55:32] northfurr: has joined #RubyOnRails
[21:55:58] ebbflowgo: has joined #RubyOnRails
[21:58:21] julio_menendez: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[21:59:01] theery: has joined #RubyOnRails
[22:02:48] ebbflowgo: has joined #RubyOnRails
[22:05:12] ruurd: hueston: actually no. it's nice and such but it lacks a functional view on one's rails project
[22:05:48] jholm: has joined #RubyOnRails
[22:07:06] ruurd: VeryBewitching there are no shortcuts. i18n-ing an app is very very difficult. if you dig into translating apps your brain will explode.
[22:07:24] ruurd: hueston Aptana IDE? Really. Don't.
[22:08:08] ruurd: I'm using RubyMine too actually I have a personal license.
[22:08:15] VeryBewitching: ruurd: I wasn't suggesting there was. Running your YAML through the translator gives you rough translation only, it would always have to be touched up.
[22:08:22] VeryBewitching: ACTION also has a personal license.
[22:08:28] fighella: has joined #RubyOnRails
[22:08:29] sargas: has joined #RubyOnRails
[22:08:41] Papierkorb: I'll try rubymine the following days. student license heh. Maybe it's better than what I'm using now.
[22:08:54] ruurd: hahahaha touching up is an oversimplification.
[22:09:08] ruurd: what are you using now?
[22:09:25] ruurd: A HA! A KDE user.
[22:09:32] theery: has joined #RubyOnRails
[22:09:32] hueston: Papierkorb, yeah student lisence ftw
[22:09:42] blokc: I'd run it through the google api translator and then pass it onto a payed service like http://gengo.com/developers/
[22:09:54] hueston: anyone else uk uni student?
[22:10:07] VeryBewitching: Papierkorb: I use Kate too
[22:10:12] ruurd: Well Kate is a kapable editor cum project stuff. But RubyMine is 'then some'
[22:10:14] VeryBewitching: <-- Kubuntu desktop user
[22:10:33] northfurr: has joined #RubyOnRails
[22:10:33] ruurd: ACTION is an OSX user
[22:10:49] Papierkorb: ruurd: All other editors either need a ton of plugins to do what Kate does out of the box, or can't do it at all. Atom is special in that it needed tons of plugins, and then after three days was an update and I would have to fix the configuration file with its abysmal CSS-esque format. "No Thanks".
[22:11:01] Papierkorb: VeryBewitching: My condolences
[22:11:43] ruurd: Atom. Brackets. Sublime. TextMate. All the same.
[22:11:48] VeryBewitching: Papierkorb: Let's not get into that debate.
[22:11:54] cashnguns: is there a way to whitelist all ips in webconsole with a production rails app on heroku?
[22:13:10] rhizome: whitelist?
[22:13:34] cashnguns: so people can download files using send_file method
[22:14:40] cashnguns: in application.rb config.web_console.whitelisted_ips
[22:15:20] lapide_viridi: has joined #RubyOnRails
[22:15:33] pontiki: i thought webconsole was only for debugging things in dev and test
[22:17:05] cashnguns: i'm getting this error Cannot render console from x.x.x.x ! Allowed networks
[22:17:13] cashnguns: I think its part of web console
[22:18:27] pontiki: why are you running it in production, tho?
[22:19:59] cashnguns: is there a better way to allow users to download files? I'm using the send_file method
[22:20:09] hueston: jw if you guys are running 2.1.1 or 2.2.1
[22:20:45] pontiki: do you want to let anyone download them, or only certain users?
[22:20:49] northfurr: has joined #RubyOnRails
[22:20:56] cashnguns: anyone who is logged in
[22:20:58] pontiki: then put them in public
[22:21:26] pontiki: anyone who is logged in -> certain users
[22:22:02] cashnguns: I'll give that a shot, previously it was in public/files, i'll switch it to just public with no sub dir
[22:22:51] gambl0re: i have a question
[22:22:56] Intii: has joined #RubyOnRails
[22:23:07] gambl0re: a post belongs to a user...user has many posts
[22:23:25] gambl0re: so that means the user_id should be included the post model?
[22:23:43] gambl0re: i do that using migration?
[22:24:00] theery: has joined #RubyOnRails
[22:24:16] Intii: Hi everyone, I'm using devise and my devise model has a habtm relationship with my Company model. When a user signs in I want to make sure the user is associated with the selected company and then permit the login. I have an attr_accessor :selected_company in my User model and that value is permitted
[22:24:35] Intii: How would I do the check since :selected_company doesn't get set by the params that have been passed by devise upon sign in
[22:25:00] gambl0re: in this example : bin/rails generate model Comment author_name:string body:text article:references
[22:25:24] gambl0re: article:references, article is the model name it is being referenced to?
[22:25:25] Mia: has joined #RubyOnRails
[22:25:50] rickmasta: has joined #RubyOnRails
[22:26:12] workmad3: has joined #RubyOnRails
[22:26:51] pontiki: Intii: when does it get set?
[22:27:14] doublemalt_: has joined #RubyOnRails
[22:28:30] Intii: pontiki: Im not sure honestly. I believe it should get set when I press sign in to login
[22:28:37] Intii: So I can use it for a check
[22:28:51] theery: has joined #RubyOnRails
[22:29:09] rhizome: Intii: create your own custom devise controller and wrap the auth with the check
[22:29:09] Intii: I've overridden active_for_authentication and implemented my check but the check always fails since selected_company is never set
[22:29:16] pontiki: seems like it's too late at that point, or else anyone signing in can just choose whatever company
[22:29:41] ruurd: Intii I think what you describe is an anti-pattern
[22:29:52] Intii: Right, they can view the list of companies, I don't mind that. I have them select the company which they want to login into
[22:30:12] Intii: My form is the email address, password, and a list of companies
[22:30:15] pontiki: so anyone can log into any company at any time?
[22:30:29] pontiki: i don't think that's what you're really after
[22:30:36] pontiki: but i might be wrong
[22:30:37] ruurd: You want to connect authentication (devise) with authorization. Disconnect them somehow and use something like cancancan or pundit to describe authorization
[22:31:42] rhizome: i'm gonna guess they want username uniqueness scoped to company
[22:31:58] Intii: ruurd: I'll check those out
[22:32:26] Intii: pontiki: As long as they have an association with that company (i.e. user.companies.includes? selected_company) then they can continue on with the login process
[22:33:23] ruurd: Intii I think you should use User for authentication together with devise. Then somehow connect the user to a company but now directly preferably but through a role relationship
[22:33:33] pontiki: Intii: yes, that's what i asked: when does that get set? you say it isn't set in sign up. great. so when does it get set?
[22:34:18] Intii: pontiki: the company associations get set by an admin. there is not sign up. the admin user will create user accounts for each of the employees
[22:34:38] pontiki: then that process should also set the association
[22:35:15] Intii: pontiki: And it does. But on the sign in form, i have a field called email, password and company. company is a list of companies, so it should get set in the params which it does
[22:35:19] ruurd: Intii HAH! GOTCHA. A User is not the same concept as an Employee...
[22:35:33] Intii: ruurd: What do you mean?
[22:35:37] Intii: I'm confused :(
[22:36:24] pontiki: Intii: so do you, or do you not, then have something to check against when the user signs in?
[22:36:34] pontiki: i heard initially that you did not
[22:37:23] Intii: pontiki: Here is my user model https://gist.github.com/dsarhadian/8a89e7de42589a688390 there is a check implemented. The problem is the selected_Company attribute is not set so the check fails every time.
[22:37:52] ruurd: Not all Employees are Users isn't it?
[22:38:12] Intii: ruurd: In terms of the database they are. They are separated by roles using the rolify gem
[22:38:19] bin_005: has joined #RubyOnRails
[22:38:32] ruurd: And how are you going to fix the problem of a user that has two parttime jobs at different companier?
[22:38:44] drale2k: has joined #RubyOnRails
[22:38:47] hotpancakes: has joined #RubyOnRails
[22:38:50] ariedler: Intii: you realize you did a cattr not a attr right ?
[22:39:10] Intii: ruurd: they can have multiple companies associated to them
[22:39:19] Intii: so user1 can have company1, company2, company3.
[22:39:33] Intii: ariedler: Should it be just attire?
[22:39:41] ruurd: Well then how are you going to make sure they have different authorizations?
[22:40:12] ariedler: @Intii well is it a Class attribute, or a Model attribute ?
[22:40:27] Intii: ariedler: model
[22:40:35] ruurd: really. user == employee is an anti-pattern.
[22:40:41] ariedler: then you mean without the C
[22:40:53] Intii: I changed it to attr and selected_company is still not set during sign in
[22:41:10] Intii: ruurd: What do you mean by different authorizations?
[22:41:18] ariedler: Intii: who sets selected_company? we have no idea.
[22:41:23] ruurd: roughly along the same line as employee IS_A person.
[22:41:50] dudo: has joined #RubyOnRails
[22:41:51] superlou: has joined #RubyOnRails
[22:42:02] ariedler: ruurd: you might be making assumptions about his application; its hard to really know with waht he has given
[22:42:03] annlewis: has joined #RubyOnRails
[22:42:32] ruurd: i might but i'm pretty sure he is thinking in the wrong direction here
[22:42:50] Intii: ariedler: the user selects it upon sign in like so: https://gist.github.com/dsarhadian/330380dab098db3c593f
[22:43:04] ruurd: authentication really is about am I sure you are the person I think you are
[22:44:21] theery: has joined #RubyOnRails
[22:44:23] ruurd: and authorization is can this person perform a particular role in this company/organization/entity/thing/application
[22:45:58] ruurd: if you're not modelling as such (using role relationships) you invariably end up in making a fucking mess of things
[22:46:31] ariedler: Intii: is is fine if you learn something the hard way that ruurd is trying to make you avoid?
[22:47:25] ariedler: he does have some really valid points, the hard part about architecting software to meet your needs
[22:47:48] crdpink: has joined #RubyOnRails
[22:48:45] ecnalyr: has joined #RubyOnRails
[22:48:58] Intii: ruurd: So how should it be setup? The user needs to have a selected_company to load the correct data from the database. So the company will have a has_many to loads, carriers, and customers.
[22:49:40] Intii: My authorization is a simple user.companies.include?(company.find(selected_company))
[22:49:47] ruurd: If a user is associated with more than one company then let him pick the company at login or any suitable other time.
[22:49:59] Intii: And I have that happening right now
[22:50:09] Intii: At login, the user picks the company he/she wants to login to
[22:50:16] Intii: My problem is validation of that
[22:50:42] Intii: In my model the check fails because selected_company fro the login form is not passed along
[22:50:45] Intii: so it's alway snil
[22:51:58] ruurd: check if there is a role relationship between user and company that allows the action
[22:52:21] Intii: user.companies.include?(company.find(selected_company))
[22:52:23] ruurd: Intii then you are doing something wrong.
[22:52:44] ruurd: The obvious way would be to store the company id in the session.
[22:53:23] Intii: Then access the session data from the model? My params upon sign in are this: {"utf8"=>"???", "authenticity_token"=>"f7mt4XWkEUQx+FPBL/TdyylhLW02Z/v2tvxImZDVEhD+G90RE+HqUQcXasqhiKfTWX2xX+5uPgqVDB9keoaAmA==", "user"=>{"email"=>"agent@dispatchpro.com", "password"=>"password", "selected_company"=>"2"}, "commit"=>"Log in", "controller"=>"devise/sessions", "action"=>"create"}
[22:53:29] Intii: selected_company is there
[22:53:36] Intii: but for some reason I can't use it in the database
[22:54:21] ruurd: The '2' comes from the option list right?
[22:54:38] ruurd: is it the same as the ID of the company?
[22:55:09] Intii: But when I do self.selected_company my app crashes saying cannot find company with id=
[22:55:20] ruurd: then you can use it to look up the company
[22:56:49] ruurd: then in that case you can look up if the user has a role in that company that allows a certain action.
[22:57:23] Intii: the company doesn't care what the user's role is
[22:57:43] ruurd: so basically everyone is admin?
[22:58:00] Intii: Yeah you can say that. the only different is that the admin can access the settings portion of the whole application
[22:58:05] Intii: Other then that they are the same thing
[22:58:24] ruurd: so they say they don't but in fact they do.
[22:58:54] Intii: what do you mean?
[22:59:57] siemprefresco: has joined #RubyOnRails
[23:00:00] ruurd: they say that they do not care what a users role is but in fact they DO care what a users role is. After all, a regular user cannot change settings.
[23:00:12] Intii: Right but it has noting todo with accessing a copany
[23:00:23] ruurd: so most users are regular users and some users are admin users
[23:00:35] Intii: i can take out the role system and the application will not change
[23:01:55] ruurd: translated: most users allowed to access the company data have the role User and some users allowed to access the company Admin but a large number of Users play no role at all in the company and aren't even allowed to start THINKING about accessing the company data
[23:02:43] ruurd: However, some users of that large contingent of users ARE allowed to access the data of a DIFFERENT company....
[23:03:15] atomical: has joined #RubyOnRails
[23:03:52] Intii: exactly i believe
[23:04:03] Intii: the application does not care if you are an admin or a user
[23:04:15] Intii: if you belong to that company you will get access to the data
[23:04:55] ruurd: but not to the settings. so in fact the application DOES care if you are an admin or a user.
[23:05:21] Intii: right but that is only one small portion of the application that has NOTHING to do with companies
[23:06:12] ruurd: and what happens if company A wants different settings than company B?
[23:06:15] ruurd: -> mayhem!
[23:07:06] Intii: ruurd: That is not the purpose of the application through
[23:07:15] Intii: the only settings are adding additional companies and adding additional users
[23:07:18] ruurd: you really want to have that kind of shit in place before they come up with it themselves. Otherwise you will have to refactor a lot of code
[23:07:41] Intii: but that is not the purpose of the application sir
[23:08:01] ruurd: tic toc tic toc tic toc...
[23:08:14] ruurd: Bedtime for me... Think about it.
[23:08:16] ruurd: Really...
[23:11:06] theery: has joined #RubyOnRails
[23:11:58] ngscheurich: has joined #RubyOnRails
[23:14:53] havenwood: has joined #RubyOnRails
[23:16:02] dudo: has joined #RubyOnRails
[23:17:03] Axilla: has joined #RubyOnRails
[23:19:42] Kallis: has joined #RubyOnRails
[23:27:05] ledestin: has joined #RubyOnRails
[23:29:16] rakm: has joined #RubyOnRails
[23:29:56] charliesome: has joined #RubyOnRails
[23:31:32] christiandsg: has joined #RubyOnRails
[23:32:42] quazimodo: has joined #RubyOnRails
[23:33:48] theery: has joined #RubyOnRails
[23:37:56] melonstorm: has joined #RubyOnRails
[23:39:15] theery: has joined #RubyOnRails
[23:39:46] drale2k: has joined #RubyOnRails
[23:41:53] christiandsg: has joined #RubyOnRails
[23:42:36] theery: has joined #RubyOnRails
[23:43:00] annlewis: has joined #RubyOnRails
[23:45:30] voltalio: has joined #RubyOnRails
[23:47:31] wldcordeiro__: has joined #RubyOnRails
[23:49:00] michaeldeol: has joined #RubyOnRails
[23:49:54] shilon: has joined #RubyOnRails
[23:49:56] Cork: has joined #RubyOnRails
[23:51:23] gambl0re: can anyone explain to me...
[23:51:34] gambl0re: when i do a = Post.first
[23:51:51] gambl0re: then i do a.comments
[23:52:06] gambl0re: it shows all the comments realated to that post
[23:52:21] gambl0re: but when i want to see all the comments i use Comment.all
[23:52:31] gambl0re: why do i use a.comments and Comment.all
[23:52:44] deol: has joined #RubyOnRails
[23:53:07] ekem: those are methods defined by the class your class inherited when it was created
[23:53:18] ekem: they help you accomplish different tasks related to the object
[23:53:29] ekem: is this an answer along the lines of what you were looking for?
[23:53:43] gambl0re: i still dont understand
[23:53:53] gambl0re: why isnt it a.comment
[23:54:03] gambl0re: why do i use a.comments
[23:54:08] ekem: oh, i see
[23:54:27] ekem: that has to do with the way rails names resources
[23:54:34] ekem: or rather names models
[23:54:39] bonhoeffer: has joined #RubyOnRails
[23:54:49] gambl0re: comments is the model name or resource name?
[23:54:52] atomical: has joined #RubyOnRails
[23:55:11] gambl0re: caues the model name is Comment
[23:55:13] gambl0re: not comments
[23:55:16] ekem: now im not that great with ror so maybe someone else can chime in
[23:55:24] ekem: but when you have a collection of objects in ror
[23:55:25] charliesome: has joined #RubyOnRails
[23:55:30] ekem: and Comment is the object
[23:55:41] bonhoeffer: i???m trying to add a form_tag to a simple_form model form, attr_accessible can???t be added to anything that derives from ActiveRecord::Base
[23:55:46] ekem: then it implies the collections by pluralizing the object
[23:56:01] ekem: let me see if i can find a link talking about it
[23:59:37] lvrbrtsn: has joined #RubyOnRails
[23:59:45] moei: has joined #RubyOnRails