Amanda

Joined

1,800 Experience
15 Lessons Completed
0 Questions Solved

Activity

I need to upload multiple large PDF files directly into a ShareFile Folder (https://api.sharefile.com/samples/ruby). Right now I am reading and saving the file data as binary data in a model and then calling it in a background job to be uploaded into ShareFile. I find that I am running out of memory in Heroku. I am sure there is a better way to do this. Any pointers/tips would be greatly appreciated.

The files have to go into ShareFile.

Thank you very much.

Posted in How to use Stripe Checkout in Rails Discussion

Hi Chris,

Are there any additional steps that we need to do when pushing this the Heroku? Locally, when a payment is processed, Pay will save it to Pay::Charges and I see it sending out the email in my logs. I've pushed this to heroku and neither one of these two actions happen. Within the Stripe Dashboard, under Payments, I can see that the payments from Heroku are being saved and logged.

Thanks!

Posted in GDPR and Rails 6

Hi, Did you figure out a solution for this? I can't seem to get it to work either... :/

Posted in How to use Stripe Checkout in Rails Discussion

Hey Chris,
Way to go on an awesome gem. It was super easy to get it all set up!!

How do you add multiple line_items to your checkout?

It would be nice to see an example of an online shop too. 😀

Posted in Render :new form is blank

In my create method I have the following:

respond_to do |format|
if @purchase_agreement.save
format.html { redirect_to admin_purchase_agreements_path, notice: 'Purchase agreement was successfully created and is pending approval by the Loan Originator' }
format.json { render :show, status: :created, location: @purchase_agreement }
else
format.html { render :new }
format.json { render json: @purchase_agreement.errors, status: :unprocessable_entity }
end
end

I have these validations in my model:

validates :buyer_email, presence: true, if: :electronic_signature?

electronic_signature is a boolean. I am checking to see that if they want to use an electronic_signature that there is a buyer_email.

The problem I am having is that when there isn't a buyer_email and it fails the validation, it is rendering the form, however, the form is blank. When I debug it, I can see that my @purchase_agreement has all the original values set from when trying to save it, as do the params but nothing is displayed on the form.

I am at a loss as to where I have gone wrong.

Thanks

Posted in How do I track the clicks to an external url?

I have a link_to do block that links to an external URL and I would like to keep track of how many times the link was clicked. What would be the best way to do this?

Thanks 😊

Posted in Database structure advice

Hi all,

I need advice on what to do with an existing table on an existing app.

Right now the table is used to store details about a property and its closing costs. Normally there are always a handful of the same closing costs per property, but we want to have the option to record a lot more of them. We would need to add around 300 more columns to a pretty large table in order to give us the flexibility we want. Adding the new 300 columns to the existing table will bring the total up to almost 600 columns. 95% of the time all of these new columns will be set to 0.

I am at a loss as to what to do. Do I just add them to the table with a default value of 0? Do I create a new table with a belongs_to / has_one relationship that stores these new 300 columns?

Thanks for the advice!

Hi,

I have Categories and CategoryType. A Category has_many CategoryTypes. In my form, I am using grouped_options_for_select to display the different category types for a category.

Form:

 <%= f.select :category_type_id,  grouped_options_for_select(@grouped_category_type_options),  {'data-width' => "100%", include_blank: 'Categories'}, {:class => "form-control border-0 shadow-0 transparent-form"} %>

Being set in the controller:

  @grouped_category_type_options = CategoryType.includes(:category).inject({}) do |options, type|
    (options[type.category.name] ||= []) << [type.name, type.id]
    options

What I want to know is that is there a way for me to also include an "all" option for the user to select "all" the category types for a set category. For example, for the category of "Hotels," the category types are "Hostel", "B&B", and "Motel". I want to also include an "All" option that will allow me to filter for all hotels regardless of the set category type.

Can anyone help me with this or point me in the right direction?

Thanks!

Hi, Once again, thanks for the video.

How would I pass parameters into the dragged "l=" bounding box? In your example we use the following:

map.addListener("dragged", function(){
    var bounds = map.getBounds();
    var location = bounds.getSoutWest().toURL + "," + bounds.getNortEast().toUrlValue();

    Turbolinks.visit('/apartments?l=${location}');
}

After doing a normal search with params[:near] and params[:category_id] my url looks like the following: www.site.com/apartments?near=tulsa&category_id=1

Where/How would I pass the parameter of catergory_id so that when I drag the map I still only see apartments that fall in my search criteria?

thanks

Posted in Making GeoSearch smooth with AJAX Discussion

Thank you for the video.

How do your render an escape javascript partial using just webpacker. For example, in the index.js.erb file you are doing the following:

$("#transaction-list").replaceWith("<%=j render partial: "list" %>");
addMarkers();

This sadly isn't working and I haven't been able to find a solution on Stack overflow. Thanks!!