#RubyOnRails - 14 July 2017
« Back 1 day Forward 1 day »
[00:01:42] rubycoder37: is there a way to dynamically add an extra attribute/field that is not in my database table, like when I do Store.all?
[00:05:50] randomA: hey im trying to figure out how to route, i've edited routes.rb with root 'home#index'
[01:14:13] rubycoder37: aperkins81: not sure what you mean, I already have the dates as an array, I'm simply trying to display them in my model, per store, and without repeating the dates all over again for each store: https://gist.github.com/anonymous/be2c4ea59ac24038422bc2d7c7f8ada1
[01:16:51] rubycoder37: e.g. if start_date and date_end results in a date of 30 days, and I have 3 stores, I give store 1 the first 10 days and so on
[01:25:30] hahuang65: randomA: you can name it however you want, with any controller. Nothing wrong with Home. Some other people might call it PagesController as a generic controller to manage other static pages besides just home
[01:39:38] hahuang65: randomA: it's fairly arbitrary, but I know it doesn't use 80 because it's far more likely to collide with another thing on your system taking port 80
[01:40:05] randomA: hahuang65: im just confused, when the user browses to the website, it goes to port 80, how would they start the rails application?
[01:42:19] randomA: is the stuff being rendered right there different than what we render using rails?
[01:43:17] hahuang65: randomA: rails is the web framework. it handles routing and network layer things so you don't have to. the rails server is just a convenience for you in development
[01:43:46] hahuang65: randomA: in prod, you'd have something in front of whatever the rails server is. usually you're not recommended to use webrick (the default in development)
[01:44:01] hahuang65: you'd use something like unicorn or puma, and have nginx or something in front of it
[01:44:19] hahuang65: randomA: when you run `rails server`, it's running a webrick server on your local development machine so you can view the page at `localhost:3000`
[01:46:17] hahuang65: randomA: unicorn is a HTTP server for rack. basically it serves your rails application
[01:46:40] hahuang65: randomA: Rails is your bridge between the web and the ruby app. it provides routing, ways to do a template for your html etc
[01:48:06] hahuang65: but you can make a simple rails app that handles some user management and associates some certificates to them
[01:48:27] hahuang65: i don't know. where do you want to host it, what does your userbase look like in terms of traffic
[01:48:42] hahuang65: I don't know if you NEED unicorn specifically, but every Rails app needs a server
[01:50:42] matthewd: Webrick isn't suitable for production, but as sevenseacat noted, that's not the default anymore
[01:51:35] hahuang65: randomA: I feel you are jumping a little too far ahead for where you are right now. You should understand how to get your rails app fully functional on your development machine first, before making any decisions or determinations on what your production app will be
[01:52:55] hahuang65: randomA: start implementing your site and when you have specific questions, feel free to ask us here
[01:53:23] hahuang65: randomA: I would recommend Michael Hartl's tutorial for a start. sevenseacat double check me here... is taht guide as dated as I am?
[02:01:42] hahuang65: randomA: awesome. so think of unicorn and puma as apache. you can configure it to listen on any port.
[02:03:32] hahuang65: I'm trying to steer him away from thinking about web servers before he needs to.
[02:05:14] matthewd: I think we should wander over to something more fundamental: randomA, are you doing this on a real server, or on your local machine?
[02:06:01] matthewd: randomA: Are you trying to deploy an application you've created, or are you just starting to create an application?
[02:06:34] hahuang65: make the app first, understand the development process, along with the development server
[02:08:23] stormbytes: what do you call a join table (migration) when both records are coming from the same table? (eg. table= child, jointable= siblings)
[02:08:25] hahuang65: randomA: I feel like you've not spent any real time with Rails to make that judgment
[02:09:05] hahuang65: randomA: You should invest some time into learning Rails before making your site if you intend to learn Rails. Or, go with what you know
[02:09:18] hahuang65: you cannot expect to jump directly into making a production app with a new language
[02:09:38] stormbytes: randomA what makes you think Laravel will be simpler? Its pretty much the same idea
[02:10:28] hahuang65: Knowing a language is different than understanding a web framework for that language
[02:10:30] matthewd: You don't need to literally follow the tutorial to make the app they're talking about, but use that to guide the steps involved
[02:10:55] stormbytes: RandomA I used Kevin Skoglund tutorial on Lynda.com for Rails 5. Its outstanding.. but assumes you some basic understanding of web technologies
[02:10:56] matthewd: (hopefully, e.g., how to use a local development environment to write the app before you deploy it somewhere)
[02:12:18] matthewd: Yeah, particularly if you're comfortable doing more exploratory learning, the getting started guide might work as a place to start
[02:12:34] matthewd: stormbytes: child/siblings is tricky, because both sides of the relationship are equal. Is that really what your relationship is?
[02:13:11] matthewd: stormbytes: i.e., given a join (a, b), does it follow that there must exist an equivalent join (b, a) ?
[02:13:17] stormbytes: matthewd I'm just practicing.. following a tut on ActiveRecord relationships and came across this conundrum.
[02:15:42] hahuang65: randomA: I hope you enjoy railstutorial and that it helps you solve your problem. Good luck
[02:16:32] matthewd: stormbytes: That is a more difficult relationship to model (quite aside from the matter of naming), because if Alice is Bob's sibling, then Bob is also Alice's sibling, by definition
[02:17:28] matthewd: stormbytes: I probably wouldn't model it with such a table, but if I did, I guess I'd name the table siblings
[02:17:45] stormbytes: I was really just wanting to know if there's some out of the box convention fo rit
[03:01:33] timdotrb_: Is anyone aware of a configuration for sunspot_rails that allows you to search an integer field? I’ve come across this post: https://stackoverflow.com/questions/11057100/solr-does-not-search-into-integers but I would prefer a more “rails” like solution
[05:55:43] [SpLaT]: dumb question - building an ultra-light-weight app and I need to capture just the user agent and client ip for the majority of the pages a user will hit. Am I better off just setting variables with requests for each page or is there a good reason to go down the session/cookie route? Is there another way that does not require a db or local storage?
[06:00:40] cjohnson: If you need to store it longer than one request then generally yes a session is the way to go. You can store the session in memory though, doesn't have to be a database
[06:16:13] krmela: hello there i have simple ransack date range all works now i am trying to enable remote true and edit code to make it works but i am failed any ideas ? source is on https://gist.github.com/netmoleCBA/b4e6eb71425b39877cf39ce51a18dea5
[06:40:05] cheeti: Hi i am storing html code as it is database but when i want to display in view it's executing. how to display with out executing html code
[07:44:45] krmela: hello there i have ransack form with date range search criteria all worked now i am like to enable on it remote true can anyone give me suggestion which ways is best to do
[08:36:18] krmela: i have question can anyone suggest me good example for ransack with remote true as i am digging and my code not find nothing if form is used
[09:31:59] krmela: good evening there , i have question i have ransack form with remote but ajax returns just same page and not ransacker record any idea ?
[12:28:25] Bacta: Hi - how feasible would it be to upgrade from 126.96.36.199 to 188.8.131.52 instead of going first to 3.0? The reason I'm asking is we're using the Rails LTS support gems and only those two versions are supported.
[14:45:12] broman: can someone please help me with ruby regex? I want to do something like @a.split("<img src='.*'>")
[15:34:03] soahccc: Hey guys, is there a maximum version of mysql2 for activerecord? It throws me the "add mysql2 to your gemfile" but it is there... I dont get it
[15:36:49] soahccc: dminuoso: well I guess it's a 4.1 project without spring but yeah I bundled. The thing is that I updated my server and I suddenly got "uninitialized constant Mysql2::Client::SECURE_CONNECTION" so I updated the mysql2 gem and now it tells me to add it to the gemfile
[15:37:26] dminuoso: soahccc: Not entirely surprising, you are using a no-longer maintained version of Rails.
[15:38:42] soahccc: Okay 0.4 was to recent I guess. It breaks with 0.3.16 and works with 0.3.18 so I guess that works for me :)
[15:40:58] dminuoso: soahccc: Most likely. It's a bit surprising that Rails would not have a pessimistic version constraint there though.
[15:42:14] soahccc: dminuoso: I think they improved the errors with rails 5, no? I think they now tell you what the version should be
[17:31:08] SilentNinja1: Hello, I'm not seeing any log data for the RoR production.log, but my App is still working. Anything I can do to check what's going on?
[18:13:19] baweaver: Typically it can be mitigated by making sure to finish out the minor versions between the majors
[22:30:07] Maletor: why am i getting this error when setting DATABASE_URL env var? /usr/local/lib/ruby/2.4.0/uri/rfc2396_parser.rb:177:in `split': bad URI(is not URI?): "mysql2://db" (URI::InvalidURIError)