Giter VIP home page Giter VIP logo

Comments (21)

etewiah avatar etewiah commented on August 28, 2024

Hello there,
I don't think it is an issue with your postgres user. It seems you have successfully created the database and run the migrations so your postgres connection details are probably okay.
First of all I'd suggest you check from the console that the migrations have run successfully. To get to the console run:

rails c

From the console run this command and let me know the result:

Pwb::User.count

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

jasonl@wyo-jol-uws01:~/jason$ rails c
Running via Spring preloader in process 1799
Loading development environment (Rails 5.1.4)
irb(main):001:0> Pwb::User.count
(0.8ms) SELECT COUNT(*) FROM "pwb_users"
=> 2
irb(main):002:0>

--

I didn't even know how to access the rails console until now..

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Okay, so you really have got the db setup right. Just to be sure there isn't some corrupt data in the db or something along those lines please run the ff to destroy and recreate the database:

rails db:drop db:create db:migrate

After that try seeding the db again:

rails pwb:db:seed

If you get the same error again we might have to do some debugging with:

https://github.com/deivid-rodriguez/pry-byebug

We could arrange a skype call and I can talk you through the process.

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

Well, the same error occurred: (not the full trace this time)

rails pwb:db:seed
rails aborted!
ActiveRecord::RecordInvalid: Validation failed: User must exist
/home/jasonl/jason/bin/rails:9:in require' /home/jasonl/jason/bin/rails:9:in <top (required)>'
/home/jasonl/jason/bin/spring:15:in <top (required)>' bin/rails:3:in load'
bin/rails:3:in `

'
Tasks: TOP => pwb:db:seed
(See full trace by running task with --trace)

I'll do some reading on the debugging tool but it looks pretty simple to install. A skype call might be a bit of a challenge, I'd like to work with your availability since I'm on UTC -7. About to leave for work soon but I will keep up with this topic throughout the day, or I can email you at the address in your profile.

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Very strange. Can you go to the console again and try running this to see if it works:

Pwb::Contact.create(primary_email: "[email protected]")

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

The contacts model is actually not crucial for the website right now so you could comment out the line for seeding it as a workaround.

Just open up this file in your text editor and comment out line 58:

/home/jasonl/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/bundler/gems/property_web_builder-b86b43186d0e/lib/pwb/seeder.rb

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

The contact creation appears to have worked. Ill comment the part you said out when I'm not working from a mobile phone.

https://gist.github.com/acmeraptor/ef9a0d2a4077322123db417f5198bf01

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

Ok, I commented out the following line:

. def seed_contacts yml_file
. contacts_yml = load_seed_yml yml_file
. contacts_yml.each do |contact_yml|
. unless Pwb::Contact.where(primary_email: contact_yml['email']).count > 0
. # Pwb::Contact.create!(contact_yml)
. end

^^the periods were added so it was a little more readable for this site

Re-ran rails db:drop db:create db:migrate

Re-ran rails pwb:db:seed

Which now produces the following full trace, https://gist.github.com/acmeraptor/528b2016f3fc49cc6ae76ff458138327

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Okay, I've just done some more research into this. It seems to be to do with not declaring a couple of belongs_to relationships as optional:

https://stackoverflow.com/questions/38983666/validation-failed-class-must-exist

I have just now pushed out a fix. To update to the latest version, run this command:

bundle update pwb

Let me know if that works.

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

Now I have this: https://gist.github.com/acmeraptor/6929b2373271dc34c8581107cd46405a

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

I am not depending on these versions of ruby or rails, if there is a working set of prerequisites then I can easily switch to them. My test server is just a virtual machine running on my laptop that I am using before I put anything on what I consider a production server. I am only running the versions of things now because they were recommended by a different guide.

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

I kind of take my last statement back. Despite the error, I now have a working test site. I think you can mark this problem as resolved. I have some other issues but I think they're not related to the one I originally posted about.

from property_web_builder.

dcallao avatar dcallao commented on August 28, 2024

hi @etewiah! I am stuck with the same error. I got rvm with ruby-2.3.4 and Rails 5.1.4. I am getting this error after I comment out the seed_contacts yml_file method above:

rails aborted!
ActiveRecord::RecordInvalid: Validation failed: Page must exist

Do you think you can help me out here? Im on Skype via dancallao

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Hi @dcallao, can you please try with the latest master branch of PropertyWebBuilder and let me know how that goes?

If you have the latest version you will see this in your Gemfile.lock:

remote: https://github.com/etewiah/property_web_builder
revision: 96a24e9

If you do get the error again, please copy it in full like acmeraptor did - it helps me troubleshoot.

In case that does not work we can certainly speak via Skype.

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Good to hear @acmeraptor - any other problems just go ahead and open another issue and I'll help you resolve it.

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

I'll keep up with this thread since someone else is having the same issue. The latest gist: https://gist.github.com/acmeraptor/27e549a6713e09405106e4e3a84e9e81

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Sorry guys, I missed out on adding the "optional: true" statement in the belongs_to page relationship for the link model.
Just added that now.
Run "bundle update pwb" once more to update to the latest and try running the seed task again.

from property_web_builder.

acmeraptor avatar acmeraptor commented on August 28, 2024

I'd say you've nailed it. rails pwb:db:seed & rails pwb:db:seed_pages completed without errors.

https://gist.github.com/acmeraptor/d45bbb6cca9dafebeaea10d872739951

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Great. I'll wait for confirmation from @dcallao and then I'll close this issue.

from property_web_builder.

dcallao avatar dcallao commented on August 28, 2024

@etewiah yup! it works now! Thx.

from property_web_builder.

etewiah avatar etewiah commented on August 28, 2024

Thanks for confirming @dcallao. I'll close this issue.

from property_web_builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.