orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 260 seconds]
tau has quit [Ping timeout: 264 seconds]
poro_ has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
poro has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
poro__ has joined #ruby
chris___ has joined #ruby
poro_ has quit [Ping timeout: 260 seconds]
chris___ has quit [Ping timeout: 246 seconds]
svf has joined #ruby
poro__ has quit [Quit: Leaving]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
imode has quit [Ping timeout: 260 seconds]
poro has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
poro has quit [Quit: Leaving]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
brunosaboia_ has joined #ruby
kaleido has quit [Quit: peas]
kaleido has joined #ruby
kaleido has quit [Changing host]
kaleido has joined #ruby
BSaboia has quit [Ping timeout: 264 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
chalkmonster has quit [Quit: WeeChat 2.8]
bradfordli has joined #ruby
<bradfordli>
Hello
jenrzzz has joined #ruby
<Dirak>
In rails migrations, if I have a table called :users and I wanted to make a belongs_to association to it, is it just t.belongs_to :user? Is it always guaranteed to be de-pluralized?
jenrzzz has quit [Ping timeout: 256 seconds]
arahael2 has joined #ruby
arahael1 has quit [Ping timeout: 258 seconds]
s2013 has joined #ruby
chris__ has joined #ruby
<havenwood>
bradfordli: hi
<havenwood>
Dirak: t.integer :user_id
<havenwood>
Dirak: You can generate that with your migration by including the relation.
<bradfordli>
havenwood: BUT im decoupling the frontend with the backend
<bradfordli>
so I have a sepearate React Frontend trying to recreate this
<havenwood>
bradfordli: Okay. Looking at the code, you're meant to pass a "session: {emai: @user.email}" param. So this isn't the standard session. It's a param you're meant to pass.
<bradfordli>
havenwood: so for that Controller, I dont have strong params set up
<bradfordli>
havenwood: would the reject everything if it isn't set?
nicholaslyang has quit [Client Quit]
<havenwood>
bradfordli: Yes, if you don't allow them, they'll not be permitted.
<havenwood>
The default is to reject.
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bradfordli>
havenwood: gotcha! wow THANK YOU
<havenwood>
bradfordli: You're welcome.
<bradfordli>
havenwood: so many questions answered !
<bradfordli>
havenwood: is Michael Hartl's examples broken ?
<havenwood>
bradfordli: Maybe for an earlier version of Rails?
<bradfordli>
havenwood: that repo implies that it is for the latest version i rails I believe
<havenwood>
badeball: Do the tests pass?
<havenwood>
oops
<havenwood>
bradfordli: ^
<bradfordli>
havenwood: mmm i havent been implementing tests because his tests are linked to Rails frontend templating framework and mine arent
<bradfordli>
havenwood: I also did not clone his repo to try
<havenwood>
bradfordli: I meant the ones in the cloned repo.
<bradfordli>
havenwood: havent tried it sorry
<havenwood>
bradfordli: That'd answer if it works.
<havenwood>
bradfordli: There's a test.
<havenwood>
¯\_(ツ)_/¯
<bradfordli>
havenwood: do I need strong params for every method in my controller classes?
<havenwood>
bradfordli: Typically, you permit all the params you'd like to allow from any method. There are certain cases where you do fine grained controls, but it's standard to permit all permissible params.
<havenwood>
bradfordli: If there's a reason one method isn't permitted to use a generally permitted param, make an exception to that rule.
<havenwood>
bradfordli: TL;DR: Permit all params that controller permits just once. All methods can use that.
Dirak has quit [Ping timeout: 256 seconds]
<bradfordli>
havenwood: got it thank you
<bradfordli>
havenwood: I didn't set strong_params yet but even `params` in pry/debugger isn't showing up anytthing at all upon POST
<bradfordli>
havenwood: is it because of @permitted=false ?
<havenwood>
bradfordli: Where's that? I don't follow.
alexherbo2 has joined #ruby
<bradfordli>
havenwood: sorry
Dirak has joined #ruby
svf has quit [Ping timeout: 260 seconds]
tau has joined #ruby
tau has quit [Changing host]
tau has joined #ruby
<bradfordli>
havenwood: so I'm stopped at the very beginning of my `create` method before any line has been executed. I type in `params` and all I see is this : https://dpaste.org/1oZD
<bradfordli>
How can to a state where I can type params and see the data I am sending over in the request? Do I need to have a `session_params` method in User.find_by -->`User.find_by(session_params)`
<havenwood>
bradfordli: Maybe better to set #action_on_unpermitted_parameters to: :log
<havenwood>
bradfordli: Instead of: :raise
<havenwood>
bradfordli: I'd suggest reading those ^ docs carefully.
<bradfordli>
havenwood: got it. Thank you! I'm going to add `ActionController::Parameters.permit_all_parameters = true` at the beginning ofr SessionsController to see what happens
<havenwood>
bradfordli: Looks like no email param was passed.
<bradfordli>
havenwood: I think i passed it, I'm using fetch() to send body : JSON.stringify({email: "", password: "", isRemembered: true}) --> https://ibb.co/q0DzhG7
<havenwood>
bradfordli: If I follow, that's the body, not query params.
<havenwood>
bradfordli: You can do whatever you'd like.
chris__ has quit [Remote host closed the connection]
<havenwood>
bradfordli: request.raw_post
<havenwood>
bradfordli: request.body.read
<bradfordli>
havenwood: sorry if I wasn't clear. but I have a signup method that used strong_params. The data sent to that method was sentt in the BODY as well but the signup method was able to parse that as well
<havenwood>
bradfordli: Strong params only protect params. (Folk were doing stuff like changing `created_at` in params.)
<havenwood>
bradfordli: You can pass whatever you'd like in the request body.
<bradfordli>
there might be a subtly I am missing or nor considering
tau has quit [Remote host closed the connection]
<havenwood>
bradfordli: I don't know off the top of my head. I'm not familiar with this codebase.
<bradfordli>
havenwood: no worries. I really apprecaite you helping me with all this. You've helped out a tremendous amount!
<bradfordli>
havenwood: this is what I am seeing for my UsersController when I type "params" : https://dpaste.org/cHyX This is what I am expecting for my SessionsController and I am not sure why I dont see it
<bradfordli>
havenwood: I think i found the issue....
<bradfordli>
I'm so stupid... I needed it. "Content-Type": "application/json" in my headers....
<bradfordli>
havenwood: thanks again for walking me through this and taking the time to help me out. I really appreciate it!
nicholaslyang has joined #ruby
<havenwood>
bradfordli: You're welcome. Any time.
<bradfordli>
havenwood: are you in the ruby discord channel? I've been trying to find more communities for ruby/rails help
<havenwood>
bradfordli: Nope, I'm not.
jenrzzz has joined #ruby
cd has quit [Quit: cd]
tau has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
code_zombie has quit [Quit: Leaving]
conta has joined #ruby
Archenoth has quit [Read error: Connection reset by peer]
chris__ has joined #ruby
chris__ has quit [Ping timeout: 265 seconds]
Besnik_b has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
romanlevin3 has joined #ruby
arahael2 has quit [Ping timeout: 260 seconds]
schne1der has joined #ruby
nicholaslyang has joined #ruby
schne1der has quit [Ping timeout: 264 seconds]
andi has quit [Ping timeout: 256 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has joined #ruby
gix has joined #ruby
Dirak has quit [Ping timeout: 260 seconds]
bradfordli has quit []
Besnik_b has quit [Quit: Leaving]
bsdband97 has quit [Ping timeout: 260 seconds]
conta has quit [Ping timeout: 264 seconds]
chris__ has joined #ruby
conta has joined #ruby
tau has quit [Ping timeout: 240 seconds]
bsdbandit-01 has joined #ruby
doug[m] has joined #ruby
conta1 has joined #ruby
conta has quit [Ping timeout: 264 seconds]
conta1 is now known as conta
AndreYuhai has joined #ruby
<AndreYuhai>
Hey there, is there any way to ignore excessive hash keys which do not represent a column in the DB passed to a class that inherits from ActiveRecord::Base?
<AndreYuhai>
Otherwise it throws ActiveModel::UnknownAttributeError
arahael has joined #ruby
conta1 has joined #ruby
conta has quit [Ping timeout: 246 seconds]
conta1 is now known as conta
ncakerlist has joined #ruby
troulouliou_dev has joined #ruby
troulouliou_dev has quit [Client Quit]
chris__ has quit [Remote host closed the connection]
bsdband41 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 265 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
brunosaboia__ has joined #ruby
brunosaboia_ has quit [Ping timeout: 260 seconds]
<ncakerlist>
why is attr_accessor: needed? i can access all the object attributes fine
<ncakerlist>
without the attr_accessor and the web tutorial doesn'st mention that
chris__ has joined #ruby
<finn[m]>
when I run `bundle install`, bundler trys to install package in system's folder and asking for sudoer's permission; but I want to install all gems to user's home folder.
<finn[m]>
I looked for it on Internet and found out that I've set value of $GEM_HOME variable.
<finn[m]>
Do I've to do anything else? And it would be nice if any article available for beginner to setting up Ruby development? I'm a beginner.
chris__ has quit [Ping timeout: 256 seconds]
<finn[m]>
*development environment.
<ncakerlist>
i can call x.y wihtout using attr_accessor ? so which situation can't i call the method
<ncakerlist>
finn[m]: i didn't setup any environment i learnt it first in irb or pry
<presiden>
ncakerlist, consider this snippet; class Foo; def initialize(); @y = 42; end end; x = Foo.new; x.y
<presiden>
that should fail with undefined method `x' for Foo
<presiden>
finn[m], did you use ruby from your os package manager or you use something like rvm/ruby-build/ruby-install?
<finn[m]>
ncakerlist: I'm creating a patch for [progit2](https://github.com/progit/progit2) project, right now I don't any intention to learn ruby; I just want to install all dependencies and generate a book.
<ncakerlist>
presiden: ok i x.y `y` is a private variable, but in web tutorial quickening it up i can access the variable mood,time ??
<ncakerlist>
presiden: it seems sthe variable mood,time are special in the browser
presiden has quit [Ping timeout: 260 seconds]
<ncakerlist>
the browser is not showing error in the web tutorial but in my local pc - it says that i need attr_accessor to access private variables rightly so
<ncakerlist>
finn[m]: use vim for ruby
<ncakerlist>
just add a cmd for that , that executes ruby code no need of repl even
<ncakerlist>
files are better aas you can go up and down, and then map F5 key to execute your code
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
alexherbo20 has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo20 is now known as alexherbo2
<jhass>
mmh, no why?
<jhass>
it's just a route, nothing all controllers need to inherit
bsdband18 has quit [Ping timeout: 260 seconds]
bsdbandit-01 has joined #ruby
brunosaboia__ has quit [Ping timeout: 256 seconds]
ldepandis has joined #ruby
brunosaboia__ has joined #ruby
conta has quit [Quit: conta]
venmx has joined #ruby
<gitter1234>
Ah okay, I see. Maybe a separate letsencrypt controller then?
<gitter1234>
And what's the purpose of `:id`? Do I need ACME challenges for every single page in my Rails app, I thought the root path would suffice?
<jhass>
The ACME protocol places the challenge at /.well-known/acme-challenge/some_random_id, I suppose to allow multiple concurrent validations in the same document root
<jhass>
but yes, a certificate is for a (number of) hostnames, not paths of a URI
Jrz has joined #ruby
<gitter1234>
Excellent, thanks jhass!
<gitter1234>
Last one: Where is that `ya6k1edW38z-your-value-here` thing supposed to come from?
<jhass>
look three white boxes up
<jhass>
the blog post is a terrible idea though
<jhass>
because it's manual and the entire point of letsencrypt/acme is to automate this
<jhass>
hence it operates with short certificate lifetimes of 90 days with a recommended rotation period of 60 days
<gitter1234>
hmmm
<gitter1234>
maybe i could use the rails crontab gem...
<gitter1234>
i dont think theres any other way to do it other than the blog post idea :/ For static sites my httpd does the trick. I was hoping maybe this'd be something Puma could do. But I'm already setting force_ssl in the Rails config, so might as well do the ACME part..
<apotheon>
Some of that acme stuff isn't related, though.
<apotheon>
Yeah, acme-client is evidently the big'un.
<gitter1234>
apotheon: yep, true indeed
<gitter1234>
jhass: rails-letsencrypt vs ruby acme-client reminds me of the whole devise vs sorcery thing
<jhass>
I don't see how
<gitter1234>
well devise is supereasy to set up but messy and convoluted, whereas sorcery is stripped down and superclean but requires a lot of time and effort to get up and running
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gitter1234>
idk, was just the first thing to cross my mind
chris___ has joined #ruby
<apotheon>
I haven't used rails-letsencrypt or the acme-client gem yet, so I'm willing to take your word for it, for now.
sphex has quit [Ping timeout: 260 seconds]
sphex has joined #ruby
<jhass>
I just scrolled down the readme of rails-letsencrypt but have written my own ACME client CLI based on acme-client and have to say that I find rails-letsencrypt to propose a convoluted and brittle approach for no obvious benefit
<jhass>
piping every SSL handshake through mruby and redis just to avoid a cronjob/systemd timer and some additional battle tested software on the host? Just no.
<jhass>
anyways, acme-client and rails-letsencrypt solve different problems (whatever problem the latter tries to solve, I'm still not sure). So there's no reasonable comparision in the first place
TCZ has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
<gitter1234>
hmm
<gitter1234>
it's that bad huh? :) doesnt promise well for rails-letsencrypt!
imode has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
why not us a standard and done ACME client? They come by the dozen
<jhass>
also why not use a standard crontab or systemd timer unit?
drincruz has joined #ruby
<jhass>
I only wrote my own client back then because I wanted something that can pulish TLSA records into my DNS via dynamic DNS updates, which didn't really exist at the time
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TCZ has quit [Quit: Leaving]
AndreYuhai has quit [Quit: Leaving]
<gitter1234>
I see. wasnt aware of tlsa records... (i do have one of those caa ones though)
<gitter1234>
definitely standard crontab sounds much better :)
<gitter1234>
i see now that blog post is a different acme client..
bsdbandit-01 has quit [Ping timeout: 256 seconds]
<jhass>
different than?
bsdband41 has joined #ruby
rippa has quit [Read error: Connection reset by peer]
rippa has joined #ruby
<gitter1234>
my bad, i confused some stuff
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
pwl has quit [Ping timeout: 265 seconds]
drincruz has quit [Ping timeout: 260 seconds]
cd has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
chris___ has joined #ruby
chris___ has quit [Ping timeout: 260 seconds]
imode has quit [Ping timeout: 260 seconds]
arahael2 has joined #ruby
dorian_ is now known as dorian
arahael1 has quit [Ping timeout: 258 seconds]
<dorian>
i have a potentially stupid question: in a `class << self` construct, is @foo equivalent to @@foo outside it?