Chris Oliver

Joined

290,590 Experience
86 Lessons Completed
296 Questions Solved

Activity

Posted in Markdown and Emoji with the html-pipeline gem Discussion

Thanks for the tip! I was wondering how long Github would allow people to use their assets.

I skipped a few of those pieces to focus on the topic in this episode. The controller and views are basically just those you get from generating a scaffold.

In the future, I'll be sure to include the code for you in between.

Posted in Upload Progress with Refile Javascript Discussion

Looks like I'll need to amend this episode. Thanks for the heads up!

Posted in Refactoring Controller Methods Discussion

Glad you're enjoying it Matt! :) Hit me up if you have any ideas for screencasts or ways to improve the site!

If there are things like legal reasons why you should separate out the DBs, then it's good to, otherwise it's often just a lot more work and much harder to maintain. You're probably best off doing without multiple databases unless you know you need that feature. Of course, that means that every record should be linked to an some sort of Account model if you don't have separation through database.

Posted in Refactoring Controller Methods Discussion

Reply would be a database model somewhere with a "state" attribute. I didn't include that part here because I didn't have the full code to begin with. You can assume it's used to keep track of the conversation and what "state" it currently is in.

Posted in Radio buttons as actual buttons

Yes definitely would if you're using something that doesn't have it built-in.

Ah yes! I'll have to do an episode on that too.

Posted in Upload Progress with Refile Javascript Discussion

If you pass the same parameters to the URL as the HTML form that gets generated it will work. Of course, you will need to make sure the mobile user has a way to authenticate as a user for that request by setting a cookie or using an API token. Mobile apps talking to a Rails app are basically the same as your browser, you just have to worry about things like cookies/API tokens.

I don't think you can with ActiveRecord since you need a database migration to add it. That's a great point for MongoDB users though! Super simple.

Posted in File Uploads with Refile Discussion

I did forget to include that. It's an awesome little feature along with deleting uploads. It definitely still is pretty new and you can do everything with Carrierwave no problem.

That could definitely give errors when nginx tries to serve them up. One thing you can do is change the nginx user to deploy. I often do that so I don't have to worry about accidentally messing up www-data ownership when I deploy.

Yeah whoops. Redcarpet doesn't do well with it apparently. Updated.

Interesting. Those should not be hitting Rails.

Maybe try this instead of the location block:

server {
  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;

  server_name xxx;
  passenger_enabled on;
  rails_env    production;
  root         /home/deploy/xxx/current/public;

  error_page 500 502 503 504 /500.html;
}

Those should automatically get served up. Can you post your config? Anything in your logs that doesn't look right?

Posted in Radio buttons as actual buttons

The Bootstrap code should actually check the radio buttons for you. You don't need to use a hidden field because with radio buttons, you set the same name for the different inputs and the browser submits only the value of the checked one. Does that make sense?

Posted in Build REST API with Devise

I think you can just simply make a POST to the same url as the sign up form normally which is /users. Same with PUT and DELETE but for logging in and out, you want to POST and DELETE to /sessions because that's a separate controller.

Posted in Upload Progress with Refile Javascript Discussion

As long as you can calculate the percentage, all you need is some CSS. Bootstrap ships with a progress bar and all you need to do is set the width to the percentage complete. http://getbootstrap.com/com...

You can find many others if you're not using Bootstrap and you just google "css progress bar"

Oh nice. I rarely tend to customize Devise routes so it has been a while since the last time I did it. Glad the gist you found worked!

Posted in Radio buttons as actual buttons

I think you'll need to use Javascript to pull it off. If you use Bootstrap it comes with support for that kind of functionality. http://getbootstrap.com/javascript/#buttons-checkbox-radio

You might also be able to do it with pure CSS but it looks like you need to use JS for IE8 support: http://stackoverflow.com/questions/5523735/how-to-make-a-radio-button-look-like-a-toggle-button