RailsCasts Pro episodes are now free!

Learn more or hide this

Recent Comments

Avatar

How about I have city also.
Country, State, City.

I have Country has_many :states, State belongs to :country
State has_many :cities, City belongs_to :state

My grouped collection
<%= f.collection_select :country, Country.order(:name), :id, :name, include_blank: true %>
<%= f.grouped_collection_select :state, Country.order(:name), :states, :name, :id, :name, include_blank: true %>

<%= f.grouped_collection_select :city, State.order(:name), :cities, :name, :id, :name, include_blank: true %>

My Javascript is

jQuery(function() {
$j = jQuery.noConflict();
var states;
var cities;
$j('#use_test_state_id').parent().hide();
$j('#use_test_city_id').parent().hide();
states = $j('#use_test_state').html();
cities = $j('#use_test_city').html();
return $j('#use_test_country').change(function() {
var country, escaped_country, options;
country = $j('#use_test_country :selected').text();
escaped_country = country.replace(/([ #;&,.+*~\':"!^$[]()=>|\/@])/g, '\$1');
options = $j(states).filter("optgroup[label='" + escaped_country + "']").html();
if (options) {

$j('#use_test_state').html(options);
return $j('#use_test_state_id').parent().show();
} else {

$j('#use_test_state').empty();
return $j('#use_test_state_id').parent().hide();
}

var state, escaped_state, state_options;
state = $j('#use_test_state :selected').text();
console.log(state);
escaped_state = state.replace(/([ #;&,.+*~\':"!^$[]()=>|\/@])/g, '\$1');
state_options = $j(cities).filter("optgroup[label='" + escaped_state + "']").html();
if (state_options) {
$j('#use_test_city').html(state_options);
return $j('#use_test_city_id').parent().show();
} else {
$j('#use_test_city').empty();
return $j('#use_test_city_id').parent().hide();
}
});
});

but city drop down not showing .

can you please suggest what i missing ?

Avatar

Testing

If you follow this cast and are testing with RSpec here is a tip.

In order for the scopes to work I added this to the before block

RSpec test before block
  before do
    sign_up_tenant(subdomain)
    @tenant = Tenant.first
    Tenant.current_id = @tenant.id

  end

I have a macro setup called sign_up_tenant that simply fills in the form and submits, but you can just create the Tenant using FactoryGirl or something similar.

The important bit is the Tenant.current_id = @tenant.id

Avatar

If anyone is using this with Devise gem and want to have unique emails per scope, here is what I added to the user model file.

user.rb
  def email_required?
    false
  end

  def email_changed?
    false
  end

This disables the Devise validation for email (only) so you can implement your own. ie Use the validation Ryan shows in this video.

Avatar

I bootstrap the advanced search form as follows:

index.html.erb
<%= search_form_for @search, url: search_customers_path, method: :post, :html => {:class => "form-horizontal"} do |f| %>
<%= f.condition_fields do |c| %>
<%= render "condition_fields", f: c %>
<% end %>
<p><%= link_to_add_fields "Add Conditions", f, :condition %></p>
<div class="form-group">
<div class="row col-md-4">
Sort:
<%= f.sort_fields do |s| %>
<%= s.sort_select({}, :class => 'form-control row_spacer') %>
<% end %>
</div>
</div>
<div class="row">
<button type="submit" class="btn btn-success">Submit</button>
<%= link_to "back", customers_path, class: "btn btn-danger" %>
</div>
<% end %>

_conditional_fields.html.erb
<div class="form-inline">
<div class="form-group">
<%= f.attribute_fields do |a| %>
<%= a.attribute_select({associations: [:category]}, :class => 'form-control') %>
<% end %>
<%= f.predicate_select({}, :class => 'form-control') %>
<%= f.value_fields do |v| %>
<%= v.text_field(:value, :class => 'form-control')%>
<% end %>
<%= link_to "remove", '#', class: "remove_fields btn btn-warning row_spacer" %>
</div>
<div class="row_spacer"></div>
</div>

application_helper.rb
def link_to_add_fields(name, f, type)
new_object = f.object.send "build_#{type}"
id = "new_#{type}"
fields = f.send("#{type}_fields", new_object, child_index: id) do |builder|
render(type.to_s + "_fields", f: builder)
end
link_to(name, '#', class: "add_fields btn btn-primary form-group", data: {id: id, fields: fields.gsub("\n", "")})
end

application.css.scss
.row_spacer {
margin-top: 5px;
}

now it is pretty. Probably won't work for everyone but it sucked trying to figure this out when you are still learning.

Avatar

Yes, I had to read this:

https://github.com/mperham/sidekiq/wiki/Advanced-Options

It is useful to take a look of that documentation too.

Regards,
Daniel.

Avatar

Zubin is right I guess.Peepcode's REST tutorial which is just $9 and is a hefty 85 minutes long has all the required source codes.

Avatar

and if i did? can I rollback somehow???

Avatar

Hi,

Just curious to know the difference between:

Stripe.createToken method used in this tutorial and Stripe.card.createToken as presented in the Stripe document.

Thanks

Avatar

For anyone who's finding that the coffeescript for this app isn't working, it's probably worth looking at this http://stackoverflow.com/questions/20081255/cannot-get-stripe-js-working-with-my-rails-4-app

Avatar

Got the same problem as you

Here is a solution I've found in http://stackoverflow.com/questions/27627286/cant-connect-localhost3000-ruby-on-rails-in-vagrant

start rails with 'rails s -b 0.0.0.0' instead of 'rails s'

Avatar

I am facing undefined method `fields' for #ProductType:0x007ffb8305a100 at http://localhost:3000/products/new?utf8=%E2%9C%93&product_type_id=1

my app/views/products/_form.html.erb file extraction of the lines which are causing the problem

<%= f.fields_for :properties, OpenStruct.new(@product.properties) do |builder| %>
<% @product.product_type.fields.each do |field| %>
<%= render "products/fields/#{field.field_type}", field: field, f: builder %>

Avatar

Two updates for this Railscast:

  1. Sidekiq no longer uses 'slim'. You don't need it in your Gemfile anymore.
  2. There's a typo in the sidekiq start command, it's missing a -q. It should be bundle exec sidekiq -q high,5 -q default
Avatar

never mind on the previous error. i just had a reference to include a file which didnt exist. I removed the include.

I have another issue though

I am using Resque.enqueue_to(queue_name, ClassName, params) and I get this error:

wrong argument type Class (expected Module)

my class file has this:
class MyClass
def self.perform(parameters, item_id)

etc

Avatar

Hi - I cannot run the rake task and I cannot find much on the internet that can assist me with resolving this. it fails loading this file which I dont have.. any ideas would be appreciated

admin$ QUEUE=* rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute resque:setup
** Execute resque:preload
rake aborted!
LoadError: No such file to load -- helpers
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in
block in require'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:230:in block in load_dependency'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:633:in
new_constants_in'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:230:in load_dependency'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in
require'
/Users/admin/sites/extendity/app/controllers/account_controller.rb:1:in <top (required)>'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in
load'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in block in load_file'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:633:in
new_constants_in'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:442:in load_file'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:342:in
require_or_load'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:307:in depend_on'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:225:in
require_dependency'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:468:in block (2 levels) in eager_load!'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:467:in
each'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:467:in block in eager_load!'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:465:in
each'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:465:in eager_load!'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/resque-1.25.2/lib/resque/tasks.rb:61:in
block (2 levels) in '
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:240:in call'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:240:in
block in execute'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:235:in each'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:235:in
execute'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:179:in block in invoke_with_call_chain'
/Users/admin/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in
mon_synchronize'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:172:in invoke_with_call_chain'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:201:in
block in invoke_prerequisites'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:199:in each'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:199:in
invoke_prerequisites'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:178:in block in invoke_with_call_chain'
/Users/admin/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in
mon_synchronize'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:172:in invoke_with_call_chain'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/task.rb:165:in
invoke'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:150:in invoke_task'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:106:in
block (2 levels) in top_level'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:106:in each'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:106:in
block in top_level'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:115:in run_with_threads'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:100:in
top_level'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:78:in block in run'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:176:in
standard_exception_handling'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/lib/rake/application.rb:75:in run'
/Users/admin/.rvm/gems/ruby-2.1.2/gems/rake-10.4.2/bin/rake:33:in
'
/Users/admin/.rvm/gems/ruby-2.1.2/bin/rake:23:in load'
/Users/admin/.rvm/gems/ruby-2.1.2/bin/rake:23:in
'
Tasks: TOP => resque:work => resque:preload

Avatar

El vídeo me da error, he seguido un vídeo gratuito de la plataforma Ruby on Rails donde emplea otra gema llamada GitHub pero está explicado en español, para aquellos que deseen información en español.

Gracias

Avatar

I ran into a "gotcha" on Rails Perf Testing that no Docs or 'Casts seem to mention. I couldn't figure out why my tests were being run 4 times, no matter what I passed in the runs: arg to self.profile_options. For example, if you place a puts in your test_ method, you'll see it output 4 times.

The Perf-Test code runs your test once for each "metric" it is measuring. So by constraining it to only :process_time, you can force the test to only run once.

ruby
self.profile_options = { runs: 1, metrics: [ :process_time ] }

(Process Time only applies to a Profile Test. For a Benchmark, you would do [:wait_time].)

Avatar

In rails 4.2 you have to use

rescue ClientDisconnected instead of IOError

Avatar

I'm currently using disqus.com for comments but I'm having SSO issues so I'm thinking of writing from scratch... Is latency an problem as the number of comments increase? Also, how can you get the comments to chain together? Thanks

Avatar

Also guys, I'm stucked with rails render hang up

Avatar

Bad Gateway error was due to Rubinius and Mail gem not working together - not related to this approach - sorry.

Avatar

How to only update one partial, such as comments_count or notifiactions_count

Avatar

I have error:
> ActiveRecord::RecordNotFound in UsersController#update
> Couldn't find all CategoryUsers with IDs (1, 3) (found 0 results, but was looking for 2)
Help me pleace

Avatar

how to make that chat application ?
in which episode this chat application is created step by step ?

Avatar

Yes, you can have one app so people only have to log in once to either system. You can set current_school just like you set current_user with something like the following if you save siteA.com and siteB.com as the domain for each school.

ruby
def current_school
    @current_school ||= School.find_by_domain(request.host)
end

Then you could use @current_school for scoping as mentioned in the episode.

Avatar

Im guessing for the current version of virtualbox and vagrant this line

'config.vm.forward_port "rails", 3000, 3000'

would instead be this line

'config.vm.network "forwarded_port", guest: 3000, host: 3000'

'exit'
'vagrant reload'
'vagrant ssh'
cd ..to rails app folder
'rails s'

but when i visit http://localhost:3000 with the WeBrick server running, i get nothing (can't find server at localhost:3000)

Any idea what I am missing?

Avatar

Why exactly is the tagging model necessary? It's being used kind of as a join table right, but for the simpler functionality it seems unnecessary. Is there something I'm missing?

Avatar

This cast is awesome, even years later as it truly helps out!

As an add-on question to developing with this, I'd like to know the following as I'm struggling with it. If you're ADDING to an existing library (ie., extending a bootstrap CSS file), then it look like the sprockets library is ALWAYS needed at the top of your SCSS files. Attempted to add in the sprockets by default in the application.css file, but it looks like the pre-parsers error - as it cannot locate the $gray-medium-light: variable in bootstrap when running. Only when the IMPORT lines are pre-pended in the file does it actually run. Is this really needed in each/every one of my CSS files which overload/extend bootstrap?

Example (in application.css) -- which I thought would globally load the bootstrap.css

*= require_bootstrap

Example of my file after having to add the @import to my css file

<--- MYFILE.CSS.SCSS --->
@import "bootstrap-sprockets";
@import "bootstrap";

/* universal */
$gray-medium-light: #eaeaea;
<------ >

Any ideas on how to get bootstrap to load globally so I can extend it in my CSS files?

Avatar

Anyone on a Mac coming along who doesn't like PgAdmin (and Navicat seems to be dying), might want to try http://www.valentina-db.com/

Nice native UI, and the free version is certainly capable enough for individuals and small teams; orgs big enough to effectively use the Pro features should find the price reasonable.

Avatar

If

ruby
gem 'rmagick', :require => 'RMagick'
bundle install

fails, make sure to check out this stack
overflow, it worked for me (OSX)

http://stackoverflow.com/questions/19274293/error-installing-rmagick-error-failed-to-build-gem-native-extension

which requires the installation of ImageMagick beforehand

Avatar

Ember.js favors Convention over Configuration which is also a Rails approach.
Here is a good benchmark of Ember, Angular and Backbone: https://www.airpair.com/js/javascript-framework-comparison

Avatar

DO THIS INSTEAD!!

$(document).on("click", "#products .pagination a", function() {
$.getScript(this.href);
return false;
});

Avatar

@shazebq, this is a little old topic but it's still applicable (and debated!) today. Heroku operates on ENV variables expected in the ENV namespace. It is used by Heroku itself for deployment as well as the 3rd-party plugins that Heroku provides (email, additional DBs, etc...).

Storing env variables in config/application.yml and reading them via code in your application.rb is only useful if your production environment can do the same. As you pointed out, you can't (easily) dynamically add the production-ready application.yml into Heroku's deployment process. Thus, using application.yml is not a good idea for Heroku deployment.

If you use Heroku (as I do for several projects) I recommend using the dotenv gem. In your local development, you have a .env file that stores environment variables. So your app code expects and uses the ENV namespace.

But you have to manually set those ENV vars on Heroku. Currently you can login to your Heroku app and they provide a clean interface to alter your ENV variables. Put your production-ready secrets and keys into that interface and your app will use them when it's deployed.

This way each developer can have their own local .env file with particular configs, yet the production system will always be consistent. The only "gotcha" is when you need to add a new env variable that you have to remember to add it everywhere.

What I have started doing is keeping application environment configs in another repo named "REPO_NAME-environments" where I have folders for development/test/staging/production and applicable config files there. This keeps them versioned and is a single place for them to exist. Goes without saying, but make sure this is a private repo.

Hope you or anyone else reading through these great comments finds this helpful! I recently did a major overhaul of some app configs myself and wanted to throw in my 2 cents.

Avatar
 NameError: uninitialized constant Api::V1::EmailController::ResponsesWorker

Even I tried to define autoload paths , still getting the same error . I am calling worker from my controller

Can any one have an idea how to fix it

Avatar

I fixed it by downgrading the sidekiq version to 3.1.x , I am getting issues with 3.2.x

Avatar

Hi I am working with rails4,mongoid4,sidekiq . I am unable to start sidekiq ,when I run the bundle exec sidekiq I am getting the following error I am not sure what happend and what to do , can anyone help me

wrong number of arguments (0 for 1)
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/actionview-4.1.4/lib/action_view/helpers/debug_helper.rb:29:in `debug'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:114:in `block (2 levels) in <class:Railtie>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:110:in `block in <class:Railtie>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `call'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `each'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/railtie.rb:194:in `public_send'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/railties-4.1.4/lib/rails/railtie.rb:194:in `method_missing'
/home/ratna/ratna/Projects/Vrcommand/Dec/dec10/vrcommand/config/environment.rb:6:in `<top (required)>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:236:in `boot_system'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:50:in `run'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/gems/sidekiq-3.3.0/bin/sidekiq:8:in `<top (required)>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/bin/sidekiq:23:in `load'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/bin/sidekiq:23:in `<main>'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/bin/ruby_executable_hooks:15:in `eval'
/home/ratna/.rvm/gems/ruby-2.1.5@vrcommand/bin/ruby_executable_hooks:15:in `<main>' 
Avatar

I tried your method , seems like it almost works, however, nothing gets inserted into the database.Also if I set the after_save :save_assigned_collections in my user model , I am not able to login thru Facebook, omniauth.

I know its an old comment , but I am hoping you are still around :).

thanks

Avatar

Thanks a lot Ryan. Is the source code available for this full implementation ? otherwise it would be better to show the source code from where your started this tutorial. Thanks in advance Ryan

Avatar

Richard,
I was having a similar issue. See Mizpah's solution above.

"We also need change how the line is written to include the nodes to stay bound to:

$(document).on("click","#game_classes th a, #game_classes .pagination a", function() {* would replace the line used in the original:
I also believe we now need the lines in application.js that load other documents (// = require somthing).

Thus my complete application.js looks like this:

ruby...
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function() {
$(document).on("click","#game_classes th a, #game_classes .pagination a", function() {
$.getScript(this.href);
return false;
});
$("#game_classes_search input").keyup(function() {
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, "script");
return false;
});
});

"

Avatar

I did the calendar_helper just like ryan but when i execute it, all it outputs is the text 'false' as well as an empty table... any thoughts where my problem might be?

Avatar

How to use endless loading with group_by . I am using will_paginate. But when add group_by it show "undefined method 'count' for AR Relation.

Avatar

Thanks. Actually the comments for that answer state that zones_map.keys is all you really need. So:

validates_inclusion_of :time_zone, in: ActiveSupport::TimeZone.zones_map.keys