These are chat archives for padrino/padrino-framework

21st
Jun 2017
Sushant Bajracharya
@sushant12
Jun 21 2017 13:02

need some help with sequel association
I have two models https://github.com/sushant12/fuitter/blob/decrease-api-req/models/facebook_page.rb
and
https://github.com/sushant12/fuitter/blob/decrease-api-req/models/account.rb
What I want to do is, when i try to save facebook_page, I want its column, foreign key, account_id be added too.

in the padrino c I did something like this

test = Account.find(id: 3)
test.add_facebook_pages = FacebookPage.create(name: "finla")

but i got an err

NoMethodError: undefined method `add_facebook_page=' for #<Account:0x00000002834f58>
Did you mean?  add_facebook_page
the weird this is that, i get stuck in the problem the whole day and then i decied to post it in gitter and then i find a solution
not sure whats up
anyway, i did test.add_face_pages(someth ere) to fix it
padrinobot
@padrinobot
Jun 21 2017 13:47
adam12 @sushant12 Glad you found the solution. add_<the_association> is indeed the correct way to use Sequel.
padrinobot
@padrinobot
Jun 21 2017 20:12
wikimatze Finally found the time to publish the post about Padrino 0.14.1 http://padrinorb.com/blog/padrino-0-14-1/
adam12 wikimatze: nice :)
wikimatze thanks adam12 for answering and helping sushant
adam12 :)
wikimatze during work it's not always easy to switch to the IRC tab and follow the discussions
adam12 wikimatze: I understand completely.
padrinobot
@padrinobot
Jun 21 2017 20:29
wikimatze that great