RailsCasts Pro episodes are now free!

Learn more or hide this

Brian Harris's Profile

GitHub User: fw-coder

Site: https://github.com/fw-coder

Comments by Brian Harris


Thanks. I had trouble getting that less theme to work, so I just decided to make my own css theme based off of the facebook theme. I put it on github if anyone else would like to give it a try:

You just set the theme to facebook and drop in this css file in place of the facebook css file.


How can I add a delete button column using the json/ajax approach? Here's what I'm trying to replicate:

<%= link_to 'Delete', product, method: :delete, class: "btn btn-mini btn-danger", confirm: "You sure?", title: product.product_number %>

Never mind, I had the javascript in two different files...Ugh!


Does anyone have a working example with Bootstrap and Ajax on Github that I could look at? I think I'm close to getting this to work, but the datatable isn't fetching the json data for some reason. I suspect it's a problem with my javascript, but I can't find the problem.

I initialize my datatables in assets/javascripts/table.js like this:

  "sDom": "<'row'<'span3'l><'span3'f>r>t<'row'<'span3'i><'span3'p>>",
  "sPaginationType": "bootstrap",
  "bJQueryUI": true,
  "bProcessing": true,
  "bServerSide": true,
  "sAjaxSource": $('#ppm_list').data('source')

and in my view I have this:

<table id="ppm_list" class="datatable table table-striped table-bordered table-condensed" data-source="<%= products_url(format: 'json') %>" style="table-layout: fixed" >

but the table is empty.


Ryan - Thanks for another great episode.

Anyone using Chosen with Twitter Bootstrap? Any issues?


Sorry if this is a noobish question, but why is the application being split into web, app, and db instances? I don't really understand that part. Is that just for Amazon or cloud-based load balancing, or is that something that I should be doing on a VPS? Thanks


Just as a follow up, I traced my problem to the user_id not being included in the join table, which was causing a validation failure. So I need to figure out how to pass the user_id to the join table (categorizations). I'm kind of stumped because the join table entries are being created behind the scenes, so to speak (i.e., I don't have an explicit statement saving those). Any help would be greatly appreciated.


I'd like to see an example where categories and products are scoped through a current user. I'm trying to modify this example to scope things through a current_user and just can't seem to get it to work.
For example, in the form, I have:

<% current_user.categories.all.each do |category| %>

and in the controller, I have:

@product = current_user.products.new(params[:product])
if @product.save

The correct list of products is displayed on the form, but the save fails...


I overcame the validation errors by adding :validate => false to the save statement in send_password_reset:

def send_password_reset
  self.password_reset_sent_at = Time.zone.now
  save!(:validate => false)

Thanks for another great episode. I'm new to Rails, and I'm learning alot from RailsCasts.
This episode gets deeper in the weeds than I've ever gone with a database. I'm not familiar with such SQL commands as tsvector. Any suggestions as to a good book or online tutorial to help me get up to speed?