shakycode

Joined

5,400 Experience
2 Lessons Completed
3 Questions Solved

Activity

Posted in Advice on building a 'reports' feature

I'm actually in the same boat right now. I'm working on creating some complex analytics and reports for an internal app. My original version of reporting is a very complex and ugly Class method. But I think using abstraction would really be helpful. I'm also looking into Ransack as well to help leverage results instead of relying on old-school methods of querying data.

I'd love to see what you come up with. Perhaps we can help each other since we're sort of in the same space.

Posted in Select Form Helper Required True Not Working

I agree that it's a bit overly complicated. Something I'm trying to get away from. Had I been thinking and not in a hurry to add a field to a bloated model I would have used a boolean instead. Would have made life much easier. :)

Posted in Deploy and delete text!

Can you provide more information on what exactly is being deleted. Is this your code base or data in the database? If you have some sort of callback in Capistrano that seeds the database upon deploy that could be an issue but without more information it's tough to say exactly what the problem is.

Posted in How to add records to has_many :through association

+1 on what Chris said. Also, it should not cause any conflicts but out of curiosity why did you choose Model as a Model name? Not criticism, just curious.

Posted in Select Form Helper Required True Not Working

I figured this out. I had to include the arguments in a hash like so:

<%= f.select :phys_option, options_for_select([["N/A", "n/a"], ["No", "no"], ["Yes", "yes"]], :selected => @run.phys_option), {:include_blank => true}, {:required => true, :class => 'select'} %>

Posted in Select Form Helper Required True Not Working

I'm doing a very simple select field in a form which looks like this:

<%= f.select :phys_option, options_for_select([["N/A", "n/a"], ["No", "no"], ["Yes", "yes"]], :selected => @run.phys_option), :include_blank => true, :required => true, :class => 'select' %>

This works with basic functionality, includes a blank option, and allows me to select the proper item from the array. But what doesn't work is the :required => true and the :class => 'select' arguments. I can submit the form without selecting anything and my select class (using select2 for dropdowns) doesn't work. Should these arguments be in a hash form instead? Or am I missing something simple here? I need the field to be required but don't want to do a model validation on it if I don't have to.

Thanks in advance, guys!

Posted in Ruby issue when doing cap deploy production

No problem, glad to see that your app is working now. Cheers!

Posted in Ruby issue when doing cap deploy production

This is fixed. Your nginx configuration was wrong with the location directive and server name being set to local host in the same namespace as your FQDN. Your app now serves on 46.101.34.7 and the form submits properly and saves the record from what I can see. Next step is to setup an A record to point nibliapp.com to 46.101.34.7 and you'll be done!

This was a simple fix but we were looking in the wrong spots, focusing too much on Rails and not enough on the infrastructure layer. :) It's happened to me before too.

Let me know how I can be of assistance.

Posted in Ruby issue when doing cap deploy production

Do you have google chat? If so add me: jelinek at gmail dot com. Or you can email me directly. All I would need is the deploy credentials to take a look for you. I won't need sudo.

Posted in Ruby issue when doing cap deploy production

Got it, I'm taking a look and your create action in leads looks right. I'd like to see what the production server is doing in realtime. If you want me to login to your droplet I'd be happy to. I'll leave that up to you.

Posted in Ruby issue when doing cap deploy production

Actually your repo is either gone or private: https://github.com/ggomersall/Nibli_leads I can't see it.

Posted in Ruby issue when doing cap deploy production

Let me look at your repo, give me a second.

Posted in Ruby issue when doing cap deploy production

Hey Gareth,

You don't have to recreate the table manually. Drop the database, recreate it, alter owner to your db user, then just run cap deploy:migrate This should get your database all squared away. Once this happens if your form does not work, please provide a snapshot of the production log and I'll take a look.

Posted in Ruby issue when doing cap deploy production

If you deleted the table, then that's a part of the problem. I would start fresh, login to the production server, drop the database, recreate it manually and assign ownership to the db user (as Chris said you may have to create that user) that you have in your database.yml file. Then after you've manually created the database run cap deploy:migrate.

Posted in Ruby issue when doing cap deploy production

You would run cap deploy:migrate or cap deploy:migrations from your local machine since this is a deployment callback.

Posted in Ruby issue when doing cap deploy production

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "leads" does not exist

Are you sure you ran cap deploy:migrations? Also does your model have any relations since this is what AR is reporting as a problem. It could also be an issue in your view/form so if you could post the code for that too that'd be helpful.

Posted in Ruby issue when doing cap deploy production

I tried hitting the URL and it gives

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

Can you provide some logs from your production server?

Posted in Simple newsletter sign up?

Getting it on Digital Ocean is easy. I can walk you through it. The GoRails deploy guide should give you everything you need to get started. Let us know where you're stuck and we'll chime in to get you all setup.

Posted in Other intermediate-advanced ruby/rails websites?

I've been playing with exercism and it's pretty cool, but I'm really digging codewars to practice up on Ruby. Great share!

Posted in Simple newsletter sign up?

Yup, looks like you are saving to database now. Glad you got it working. I just signed up myself on your app to test. ActiveAdmin shows my lead.

Your assets are still an issue so I'm not sure if you re-deployed with the proper code or not. If you get stuck, let me know.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.