eelcoj

Joined

8,330 Experience
0 Lessons Completed
10 Questions Solved

Activity

Posted in add index to nested forms

Looks like there's index method availalbe
https://apidock.com/rails/v4.0.2/ActionView/Helpers/FormHelper/fields_for

So it should work like this:


<%= form_for @person do |person_form| %>
...
<%= person_form.fields_for :projects do |project_fields| %>
Project #<%= project_fields.index %>
...
<% end %>
...
<% end %>

In your case you should be able to pass it, like:
<%= render 'profile_fields', f: profile_form, i: profile_form.index %>

Posted in Best Rails error monitoring software ?

I've been trying and enjoying https://www.bugsnag.com with last projects.

Also check for a 100% solution: https://gorails.com/forum/exception-error-reporting-from-live

Posted in Shrine vs. Carrierwave

It all boils down to personal preference. If you are comfortable using Carrierwave, continue using that.

Posted in Link_to error

Your current link will be a relative link. If you do <%= link_to "About", about_path %> it should work as expected. All links defined in your routes file can be found through rake routes (or rails routes). "Simply" append _path to each link from the first column to get every correct url within your app.
Also if you want to link from an external source, eg. mailer, you can append these with _url.

This resource might be useful: http://guides.rubyonrails.org/routing.html

Posted in Exception/error reporting from live.

Why not? You mean it's not an add-on?

Posted in Exception/error reporting from live.

There are many of them. Recently got tipped on https://www.bugsnag.com Really fair free plan!

if you want a 100% free, but simple solution, you can use https://rubygems.org/gems/exception_notification together with https://rubygems.org/gems/slack-notifier. It will only be a couple lines of code.

Posted in Receiving incoming emails

Not 100% sure if this is what you're after, but to receive/parse emails, https://rubygems.org/gems/griddler is possibly your best choice.

Posted in NameError: uninitialized constant Stripe

Did you forget to require stripe?

No, the method should be in the model. That's where the data "lives".
The controller, just… erm… controls the data.

What could be a solution is that you add associated records from the Invoice model. So within your attributes you call that method, eg. %w{ Date Vendor_name product_name}

    def product_name
        self.product.name
    end

Posted in Rails How to link an email form with Sendgrid?

Within your create @contact.save? method in your contact controller. You can call ContactMailer.new_request(@contact.id).deliver_later

The mailer can be easily generated with rails generate mailer contact new_request.

Btw. and bit unrelated. If you are just using smtp (and not Sendgrid's API), there's no need to initialize anything.

Posted in How can I do drop down dependencies?

Not sure what you are asking. A way to "populate" a select tag with an associated model?

Also played with, and have some answers:

1 There's a beta feature who supports backups of your PG DB (see menu left-hand, Backups)

3 For memory; 1GB is the minimum. Otherwise loads of errors.

5 No shortcut I am aware off. Possible can create a bash/zsh shortcut in your project folder: ssh <name>@<ip> \\ cd <app-name>/current && bundle exec rails console?

Posted in Best way to build a Contact Us page

Table-less seems like the way to go for contact forms.

The only part missing from a quick look is the set up of an Email service. I can recommend , really easy to integrate in your Rails app: https://www.mailgun.com

If you have/use iTunes you can download, store and watch from there.

Be sure to add any questions if you have any!

Should be pretty straightforward with https://github.com/thoughtbot/griddler

Readme there is pretty clear too!

Posted in CMS in Rails

Isn't every defailt getting started tutorial a blog? Even dhh did a howto with 5.1 release. :)

What are you currently missing from existing guides/tutorials/howto's?

To follow-up on Chris' last reply, in the past I've done:

self.slug = SecureRandom.hex(2).

on a model create method and then added that as part of the slug.


SecureRandom (apidock)