Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Brian Harris's Profile

GitHub User: fw-coder

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

Comments by Brian Harris

Avatar

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:
https://github.com/fw-coder/jQuery-TokenInput-Bootstrap-CSS-Theme

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

Avatar

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

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

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

Avatar

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:

js
$('.datatable').dataTable({
  "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:

js
<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.

Avatar

Ryan - Thanks for another great episode.

Anyone using Chosen with Twitter Bootstrap? Any issues?

Avatar

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

Avatar

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.

Avatar

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:

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

and in the controller, I have:

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

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

Avatar

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

ruby
def send_password_reset
  generate_token(:password_reset_token)
  self.password_reset_sent_at = Time.zone.now
  save!(:validate => false)
  UserMailer.password_reset(self).deliver
end
Avatar

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?