Sorry about that, problem is on line highlighted. This is sunspot_configuration.rb:
ActiveRecord::Base.class_eval do > > class << self > > alias_method :super_searchable, :searchable > > def searchable(*args, &block) > > Search::Models.register self > > Sunspot::DSL::Fields.instance_variable_set '@current_model', self > > super_searchable(*args, &block) > > end > > >> def searchable_fields > > @searchable_fields ||= {} > > end > > end > > end > > >> Sunspot::DSL::Fields.class_eval do > > alias_method :super_text, :text > > def text(*args, &block) > > super_text(*args, &block) > > register_fields 'text', args > > end > > >> alias_method :super_method_missing, :method_missing > > def method_missing(name, *args, &block) > > super_method_missing(name, *args, &block) > > register_fields name, args > > end > > >> private > > def register_fields(search_type, fields) > > fields.each do |field| > > current_model.searchable_fields[field.to_sym] = Search::Field.new( > > current_model, field.to_sym, search_type.to_sym) > > end > > end > > def current_model > > Sunspot::DSL::Fields.instance_variable_get '@current_model' > > end > > end > > >> require_relative 'sunspot_custom_types' > > require Rails.root + 'lib/util/generic_decorators.rb' > > # Eager load all the models so that the search data is readily available > > require Rails.root + 'app/models/search.rb' > > Dir[Rails.root + 'app/models/**/*.rb'].each do |file| > > next if file.include?('/concerns/') || file.include?('/freshdesk_local/') > > >> if file.include? '/liquid/' > > require file > > else > > /app\/models\/(?<model_name>[\w\/]+\.rb)/ =~ file > > Kernel.const_get "#{model_name.gsub('.rb', '').camelize}" > > end > > end > > > El miércoles, 22 de julio de 2015, 15:28:02 (UTC-3), Colin Law escribió: > > On 22 July 2015 at 17:52, agusddt <agu...@gmail.com <javascript:>> wrote: > > Fred, thanks for your answer. > > The thing is that I cannot run "rails server"on localhost, it terminates > > immediately. > > You have not said what is in > config/initializers/sunspot_configuration.rb:52 as suggested by Fred > > Colin > > > > > El miércoles, 22 de julio de 2015, 13:20:04 (UTC-3), Frederick Cheung > > escribió: > >> > >> > >> > >> On Wednesday, July 22, 2015 at 5:17:29 PM UTC+1, agusddt wrote: > >>> > >>> I was uploading my app to a server, put it in production mode on the > >>> server, still on development mode locally and suddenly I cannot run > "rails > >>> server" anymores since it dies automatically with this error: > >>> > >>> > >>> > /Users/agusddt/developments/crm/config/initializers/sunspot_configuration.rb:52:in > > > >>> `block in <top (required)>': undefined method `gsub' for nil:NilClass > >>> (NoMethodError) > >>> > >>> from > >>> > /Users/agusddt/developments/crm/config/initializers/sunspot_configuration.rb:45:in > > > >>> `each' > >>> > >>> from > >>> > /Users/agusddt/developments/crm/config/initializers/sunspot_configuration.rb:45:in > > > >>> `<top (required)>' > >> > >> > >> [snip] > >>> > >>> > >>> Taking a look into the logs appears just a warning: > >>> > >>> DEPRECATION WARNING: Currently, Active Record suppresses errors raised > >>> within `after_rollback`/`after_commit` callbacks and only print them > to the > >>> logs. In the next version, these errors will no longer be suppressed. > >>> Instead, the errors will propagate normally just like in other Active > Record > >>> callbacks. > >>> > >>> > >>> > >> I doubt this warning is relevant - the probably is almost certainly in > >> config/initializers/sunspot_configuration.rb:52 > >> > >> Fred > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to rubyonrails-ta...@googlegroups.com <javascript:>. > > To post to this group, send email to rubyonra...@googlegroups.com > <javascript:>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/rubyonrails-talk/62f3862d-460f-4b4c-a7b7-a31e4b887935%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b32e9ba9-e4dd-4860-a688-d2f4d1b912ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.