Chris Oliver

Joined

291,530 Experience
86 Lessons Completed
296 Questions Solved

Activity

This is looking pretty good. I think the tough spot now is that you need to set the update to set the tasklist_id as well.

I think this should work:

def sort
  @list_id = params[:list].first
  @items = params[:item]
  @items.each_with_index do |id, index|
    taskitem = Taskitem.find(id).update(tasklist_id: @list_id, position: (index +1))
  end
  render :nothing => true
end

Hey Alexander, I don't know the PayPal API very well, but they own Braintree and I have done an episode on that: https://gorails.com/episode...

Braintree lets you do both PayPal and credit cards so you can pick whichever you need. I'd recommend using it over the PayPal API directly for most all cases.

Ah I see, kinda like Trello board columns. I believe you would want to make sure you submitted the tasklist for the one that the item landed on. You would probably need to check that and see what $(this) references, whether it was for the column it was picked up, or the column of where it dropped. Then server-side you can take those items and make sure that they're all updated with the correct tasklist_id which would do the moving of the item between tasklists on the db side.

This might make for a good screencast.

Posted in How do you charge for building web app projects?

Hey Arjun!

This is a fantastic question. I had a bunch of different methods of doing this over the years and yours sounds very much like what I did.

What I finally ended up with was charging a flat fee per project. This worked because I generally had a long in-depth conversation about what needed to be built and charged extra to account for any changes that were likely to come up. If things deviated too much from the original plan, I'd usually have to cut the project off at a point and renegotiate things. This didn't happen often, but it was a concern. If you get done early, you make more profit. This is the big plus that the other hourly, daily, or weekly options don't really have, but you can also lose money here if you screw things up.

Another option I did for more open ended projects was to do weekly or daily pricing. They could buy chunks of my time and that works out really well. I know my budget and availability and they can budget as well for things.

One thing for me was that I only did the building part, so you've got to also account for the Wireframing, Design and Slicing parts. I can imagine that those have a lot more back and forth with the clients. Generally I had someone else doing the designs but I might participate in that part helping to improve the flow of the app and everything.

As for budgeting things, I'd usually try to find out how deep the customer wants to go on things and what their budget was. I'd tell them that their budget dictated a lot of what we might build. Since I worked for a lot of startups, we might start out with a small $2k-5k project to make sure we work together well and that what we were building is on the right track. A proof of concept if you will. It helped align their ideas with how much money would be required to build their bigger vision stuff as well and I knew that if we did a good job on the first project, we could work again on a larger one.

Hey Chris,

That's a good question. Honestly the Railscasts episode is probably the most recent that I've seen on that. http://railscasts.com/episodes/147-sortable-lists-revised?view=comments

I should do an episode on it, but I don't think too much has changed. The general idea is that you will keep track of the sort order in the db and then when the user drops an item, you tell the server to update all the positions of items accordingly.

Posted in Login with Facebook Discussion

That would make for a good episode. I'll add this to my list. Luckily most of them, even Twitter, now provide email address.

The rough idea is that you should save the omniauth auth info to a cookie, and then redirect the user to set their email and save it all together.

I noticed that a bit earlier today. Got a new computer to record on though so I've lost my old Screenflow settings. Possibly something with their export options that wasn't rendering at the highest quality.

Thanks so much Nick, you've always been a big supporter! 🎈🎈🎈

Thanks Alex! I appreciate it so much. :D

Posted in Login with Facebook Discussion

Fixed!

Posted in Direct File Uploads to S3: Part 3 Discussion

You're welcome and thanks for the encouragement and the support!! 🍻

There's a couple options for this generally:

  1. You can do this in the registration controller right after a successful save.
  2. Or you can do this in the model after_create (which might be simplest). I'll show that one here:
class User < ApplicationRecord
    has_many :likes

    after_create :create_default_likes

    private

    def create_default_likes
        # Create your likes here
        [1,2,3].each do |id|
            likes.create post_id: id
        end
    end
end

For the controller version, you'd basically do the same thing just after the if user.save. If you use something like Devise, you'll have to override the controller to do that.

Okay great, and yeah each file upload gem is slightly different than the others so it can change the code you write just slightly which was the reason I asked.

That would be beacuse in your file_tag you're not referencing your @post instance variable since you only have a local post variable there.

For links you will want to do a regular link_to:
<%= link_to "View File", @post.file.url %>

It's as easy as SSHing into your server and running sudo apt-get install cmake.

If you're interested in trying out a new feature, I added Scripts at the top of the page and you can create little bash scripts to install things like cmake. You can create a new Recipe and paste that line into that and tell it to run on your server (as root, not deploy) and it'll install it for ya.

Agreed! Any other debugging topics you'd like to see?

Thanks Scott! 🍻

Posted in PDF Receipts not working

Well your snippet there was using @charge which would cause that because you didn't set the charge variable (and you can't since the user has multiple charges. You want resources plural because there are many charges and the user should be able to view each charge and the ID needs to be passed in to the charge_path. If you use both those that I mentioned you should be good.