#RubyOnRails - 22 January 2019
« Back 1 day Forward 1 day »
[00:47:34] thoraxe: hmm... so i'm using devise, I have jquery vendored in, jquery is definitely working, but the sign_out delete method thing doesn't seem to be working. Chrome is just doing GETs when I click the link
[01:01:46] DoctorMonocular: hey, I have an activerecord model I run a query for by doing some stuff like query = Model.where(...).etc , then return query.all
[01:03:46] lupine: normally this is good, but if it's bad, you can always explicitly `.to_a` at the right point
[01:05:36] DoctorMonocular: I do -- is the usual behavior for each to trigger a new query for a relation?
[13:11:42] blackmesa1: Hi all. Ive been using active storage. I just checked that images are viewable by everyone via the direct image links. https://mydomain.com/rails/active_storage/disk/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/image?content_type=image%2Fpng&disposition=inline%3B+filename%3D"image"%3B+filename%2A%3DUTF-8%27%27image
[13:15:21] blackmesa1: https://stackoverflow.com/questions/49808950/secure-active-storage-with-devise
[17:52:57] broman: can anyone please help me? I have a rails 3.2 application and I'm trying to run it locally using rails_env=production.. the database.yml is set but when I try to run the rails s, it gives me the "database configuration does not specify adapter" error
[17:56:30] broman: fox_mulder_cp, but it is on the database.yml file... if I do a rails s -e development it works
[17:58:07] broman: if a change the name from production to productions on database.yml and do a rails s -e productions, it works
[18:00:36] MrPunkin: Hey all. Given a class like this (https://github.com/miastologia/basecamp3-api-wrapper/blob/master/lib/basecamp3.rb) how can I extend it via concerns? The normal method doesn’t seem to be changing the dynamic subclasses of Basecamp3 at all.
[18:09:12] havenwood: MrPunkin: The docs have good examples: https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
[18:10:17] MrPunkin: I need to extend that existing Basecamp3 ‘eigenclass’ so I can overwrite the connect method.
[18:32:52] fox_mulder_cp: broman your production database section can't contain adapter type line. check and compare development and production section. it's missmatched
[20:04:31] ivanskie: hi, im running rails in docker. with compose.. and i specified bundle to install gems into ./vendor folder. im still getting this:
[20:04:32] ivanskie: core_1 | /app/vendor/ruby/2.3.0/gems/rake-12.3.1/lib/rake/version.rb:3: warning: already initialized constant Rake::VERSION
[20:04:32] ivanskie: core_1 | /usr/local/bundle/gems/rake-12.3.1/lib/rake/version.rb:3: warning: previous definition of VERSION was here
[20:04:33] ivanskie: core_1 | /app/vendor/ruby/2.3.0/gems/rake-12.3.1/lib/rake/version.rb:6: warning: already initialized constant Rake::Version::MAJOR
[20:04:34] ivanskie: core_1 | /usr/local/bundle/gems/rake-12.3.1/lib/rake/version.rb:6: warning: previous definition of MAJOR was here
[20:20:17] tpanarch1st: i'm a bit lost on how postgres sql comes into play with rails, whenever i've worked with a CMS, for example, it's use mysql and required that to be installed. The tutorials i've seen don't seem to require this
[20:55:59] MrPunkin: tpanarch1st: That’s because Rails defaults to Postgres which is a different DB.
[20:56:16] MrPunkin: tpanarch1st: You can install it, or you can opt to make your Rails project use MySQL instead, or any of the many DB clients available
[21:01:38] tpanarch1st: thanks for this MrPunkin so i think, by installing ruby and also rails, postgres comes down with it?
[21:02:12] MrPunkin: I don’t believe it gets installed, I believe you still need to install it. I’ve never used it though, so I’m not the one to ask.
[21:02:53] MrPunkin: I believe it just expects it and installs the gem to interact with it, and you need to configure it with the port, host, username, password, etc to use it.
[21:04:14] tpanarch1st: beanie@laptop ~ $ \curl -sSL https://get.rvm.io | bash -s stable --ruby Installing required packages:...sqlite3
[21:07:22] tpanarch1st: thanks for this MrPunkin any objection to me having just done all this? https://github.com/coder-academy-students/rails-setup-for-linux
[21:07:53] MrPunkin: tpanarch1st: nope that seems like a good first step to get Ruby ready on your system before diving into rails.
[21:08:28] MrPunkin: That’s what I always do first on a new machine, get RVM installed with whatever ruby I want and the rails version I want
[21:09:11] MrPunkin: regarding Postgres / MySQL / SQLite… you’re going to need to do your research as to which to use. If you are familiar with MySQL I’d say just stick with that unless you wanna learn something new
[21:14:10] MrPunkin: tpanarch1st: I’m not really sure. SQLite is probably the most popular by installs, as they claim to be on most mobile phones and computers by default
[21:16:51] MrPunkin: I use Atom and am happy with it. I primarily just use it for writing code and then running my tests within the app
[21:17:40] tpanarch1st: i guess testing out the app just involves visiting a web address of some description locally - i think there's a way of telling rails to fire up a test server
[21:19:03] tpanarch1st: ah sweet, is it possible/worth bothering to incorporate terminal for rails within atom
[21:19:30] MrPunkin: You can run any normal terminal commands within Atom I believe, but I tend to keep my Mac terminal open instead
[21:19:50] tpanarch1st: sweet, thanks ever so much for all of your advice, it's very much appreciated
[21:20:28] tpanarch1st: i wanted to create a vinyl database, i've watched the blog tutorials a few times, is there a good tutorial for that kind of application geared towards a newb like me?
[21:24:17] tfitts: I'm wondering if anyone knows when using ActiveModelSerializers if there is a way to have a has many relationship return nil or even not have the key in the json response instead of having an empty array
[21:24:48] tpanarch1st: thanks MrPunkin i shall plug away at that - i guess my project will be explained to me through working on that
[21:27:06] MrPunkin: tfitts: an easy way would be to simply hijack the as_json method on your model and override or delete the key in question based on your own criteria
[21:32:44] MrPunkin: Can anyone tell me how to add methods to a class defined in a gem? I’ve tried every example I can find online and none are making them available on instances of that class.
[22:52:24] dozzed: i need a dev for very simple site, pm me if someone wants a littl ebit of money, maybe you have account in fiverr
[23:21:00] istrasci: I have an association User has_many :address. How can I make a second association has_one :home_address by giving a condition of the Address (like type = 'home')?
[23:27:55] blackmesa: I am using Minitest. when I use "Class.create!" in a controller test, the record isnt saved to the test database. Only fixtures are stored?