NoMethodError in Human_resources/leaves#index - ruby-on-rails

It was working few days ago, don't know what had went wrong...
**undefined method `name' for nil:NilClass**
Extracted source (around line #26):
23: %td= number_with_precision(employee.compensation_leave_balance, precision:1)
24: #calendar.tab-pane.fade
25: = calendar(:year => 2012, :month => 6, :first_day_of_week => 1, summary: "Leave Calendar", calendar_title: "June", month_header: true) do |date|
26: - render_leave_calendar_cell(date)
27: #trash.tab-pane.fade
28: = render 'table', leaves: #leaves.where(deleted: true)
app/helpers/leaves_helper.rb:11:in `block in events_for'
app/helpers/leaves_helper.rb:10:in `events_for'
app/helpers/leaves_helper.rb:4:in `render_leave_calendar_cell'
app/views/human_resources/leaves/index.html.haml:26:in `block in _app_views_human_resources_leaves_index_html_haml__145883348_88978910'
app/helpers/calendar_helper.rb:146:in `call'
app/helpers/calendar_helper.rb:146:in `block in calendar'
app/helpers/calendar_helper.rb:145:in `upto'
app/helpers/calendar_helper.rb:145:in `calendar'
app/views/human_resources/leaves/index.html.haml:25:in `_app_views_human_resources_leaves_index_html_haml__145883348_88978910'
really don't know what went wrong
a/h/leaves_helper.rb
1 module LeavesHelper
2 def render_leave_calendar_cell(date)
3 html = content_tag(:span, date.day, class: 'dayDisplay')
4 html += content_tag(:div, events_for(date))
5 raw(html)
6 end
7
8 def events_for(date)
9 html = ""
10 current_company.leaves.where("start_date <= '#{date}' and return_date > '#{date}'").where(deleted: false).each do |leave|
11 html += content_tag(:div, leave.applicant.name, class: 'leaveName')
12 end
13 raw html
14 end
could it be the date nil? how to fix this ><
much appreciate
Billy

as abhas already stated, leave.applicant is nil for at least one of the leaves.
go to your database and find out which it is. then figure out what to do with your leaves. delete them too, re-add the missing applicant or what ever data migration might be sensible.
a quick fix would be to skip if an applicant is missing:
html += content_tag(:div, leave.applicant.name, class: 'leaveName') if leave.applicant.present?
i would also have a look if you properly configured the delete cascades in your application. this often causes such problems. if you want to enforce safety in this regard, you should add database constraints, that ensure that no referenced entity gets deleted.

Related

Encoding::CompatibilityError in Observations when access active directory from rails

I have established a connection to Active Directory through ldap/net. I am trying to pull AD attributes and values.
If I use the following code (using values.inspect) the query works.
<% #temp_search.each do |user| %>
TS = <%= user.sn %> <br>
<% user.each do |attribute, values| %>
<%= attribute %> <br>
<% values.each do |value| %>
<%= value.inspect %><br>
<% end %>
<hr style="border-color: red">
<% end %>
<% end %>
The portion of my controller doing the ldap query is s
filter = Net::LDAP::Filter.eq( "sn", "mendla" )
treebase = "dc=ccttapes1,dc=com"
#temp_search = ldap.search( :base => treebase, :filter => filter )
p ldap.get_operation_result
What I can't seem to get to is to just get the value for one particular attribute - for example, givenname.
I see results such as
cn
"Chris G. Mendla"
sn
"Mendla"
description
"Test account 1 for rails apps - DO NOT CHANGE PW"
givenname
"Chris"
initials
"G"
distinguishedname
"CN=Chris G. Mendla,OU=Users CCT,DC=CCTTAPES1,DC=com"
However, if I change <%= value.inspect %><br> to <%= value.givenname %><br> I get an error of
NoMethodError in Observations#index
Showing C:/Users/cmendla/RubymineProjects/employee_observations/app/views/observations/index.html.erb where line #61 raised:
undefined method `givenname' for "CN=Christopher Mendla,OU=Users CCT,DC=CCTTAPES1,DC=com":Net::BER::BerIdentifiedString
Rails.root: C:/Users/cmendla/RubymineProjects/employee_observations
Application Trace | Framework Trace | Full Trace
app/views/observations/index.html.erb:61:in `block (3 levels) in _app_views_observations_index_html_erb__474218211_78240600'
app/views/observations/index.html.erb:60:in `each'
app/views/observations/index.html.erb:60:in `block (2 levels) in _app_views_observations_index_html_erb__474218211_78240600'
app/views/observations/index.html.erb:58:in `block in _app_views_observations_index_html_erb__474218211_78240600'
app/views/observations/index.html.erb:56:in `each'
app/views/observations/index.html.erb:56:in `_app_views_observations_index_html_erb__474218211_78240600'
and if I try ``<%= givenname.value %>` I get
NameError in Observations#index
Showing C:/Users/cmendla/RubymineProjects/employee_observations/app/views/observations/index.html.erb where line #61 raised:
undefined local variable or method `givenname' for #<#<Class:0x9cd0230>:0x9fadaf0>
Rails.root: C:/Users/cmendla/RubymineProjects/employee_observations
Application Trace | Framework Trace | Full Trace
app/views/observations/index.html.erb:61:in `block (3 levels) in _app_views_observations_index_html_erb__474218211_83715540'
app/views/observations/index.html.erb:60:in `each'
app/views/observations/index.html.erb:60:in `block (2 levels) in _app_views_observations_index_html_erb__474218211_83715540'
app/views/observations/index.html.erb:58:in `block in _app_views_observations_index_html_erb__474218211_83715540'
app/views/observations/index.html.erb:56:in `each'
app/views/observations/index.html.erb:56:in `_app_views_observations_index_html_erb__474218211_83715540'
Request
My goal is to be able to search for an AD record by first and last names and then pull values for attributes such as mail or memberof.
(I am using ldap-net
In your example #temp_search should be an array of users that meet your search criteria. Each one of those users is a Net::LDAP::Entry object. On those objects you can call methods are available corresponding to the users attributes.
If only one user is returned, the Net::LDAP::Entry object will still be inside an array. In that case you could call something like:
#temp_search.first.cn
You can also call:
#temp_search.first.attribute_names to see all available attributes for that object.
For example, you could do something like:
<% #temp_search.each do |user| %>
#call user attributes
user.cn
user.memberof
#etc, other attributes
<% end %>

RSS Feed Entries - Encoding::CompatibilityError incompatible character encodings: ASCII-8BIT and UTF-8

I am currently working on an RSS feed that was working for a while but now has an encoding issue. After trying many of the solutions here unsuccessfully, I have deduced that I may be having issues with the feed parser.
The error starts with the index page:
ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
11:
12: <div class="entry_wrapper">
13: <div class="entry_box">
14: <% feed.entries.each do |entry| %>
15: <p class="entry_title"><%= sanitize link_to entry.title, entry.url %></p>
16:
17:
app/models/feed.rb:6:in `entries'
app/views/feeds/index.html.erb:14:in `block in _app_views_feeds_index_html_erb__2672739530113604393_70126099705280'
app/views/feeds/index.html.erb:5:in `_app_views_feeds_index_html_erb__2672739530113604393_70126099705280'
Here is larger section of the Feed#Index page:
<% #feeds.each do |feed| %> # Line 5 here
<p class="feed_url">
<%= link_to feed.url, feed %>
<%= link_to "Edit", edit_feed_path(feed), class: "blue" %>
<%= link_to "Delete", feed_path(feed), method: :delete, data: { confirm: 'Are you sure you want to delete this feed url?' }, class: "blue" %>
</p>
<div class="entry_wrapper">
<div class="entry_box">
<% feed.entries.each do |entry| %>
<p class="entry_title"><%= sanitize link_to entry.title, entry.url %></p>
I deleted the Feed URL's in the console so the page rendered fine without any urls to pull from. However, as soon as I added one, I got the same error as before.
I tried testing the encoding of the Feed entries in the console and got the following error:
2.1.1 :001 > g = Feed.last
Feed Load (0.1ms) SELECT "feeds".* FROM "feeds" ORDER BY "feeds"."id" DESC LIMIT 1
=> #<Feed id: 9, name: nil, created_at: "2016-01-18 05:01:54", updated_at: "2016-01-18 05:01:54", url: "http://feeds.feedburner.com/MattsTravelSite">
2.1.1 :002 > g.entries
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/entities.rb:77:in `gsub'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/entities.rb:77:in `decode'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/entity_decoder.rb:14:in `decode'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/entity_decoder.rb:5:in `try_decode'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/sax_parser.rb:151:in `on_text'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/parser.rb:541:in `_rule_33'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/parser.rb:239:in `block in each_token'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:237:in `call'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:237:in `add_token'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:439:in `on_element_end'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:190:in `advance_native'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:190:in `block in advance'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:137:in `read_data'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/lexer.rb:189:in `advance'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/parser.rb:236:in `each_token'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/oga-2.0.0/lib/oga/xml/parser.rb:269:in `parse'
... 20 levels...
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/commands/rails.rb:6:in `call'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/command_wrapper.rb:38:in `call'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:183:in `block in serve'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:156:in `fork'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:156:in `serve'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /Users/danieluribe/.rvm/gems/ruby-2.1.1/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/danieluribe/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/danieluribe/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
I double-checked to see if the website I am pulling from is in UTF-8 encoding at the W3C-Validator website:
This document was successfully checked as well-formed XML!
Result: Passed, 1 warning(s)
Address:
http://feeds.feedburner.com/MattsTravelSite
Encoding: utf-8
Doctype: XML
Root Element: feed
Root Namespace: http://www.w3.org/2005/Atom
I tried "forcing" the encoding in the model, but I think my coding skills are a little lacking in terms of creating methods. Here is the entries model I created originally for the Feed that is being used in the Feed#Index.
class Feed < ActiveRecord::Base
has_many :items
def entries(num = 3)
Feedjira::Feed.add_common_feed_entry_element("img")
feed = Feedjira::Feed.fetch_and_parse(url)
feed.entries.take(num)
# add_items(feed.entries) # Saving items to database
end
....
Since this model was working before, I'm not sure what happened. I did take a few months from the app so I don't know if anything changed with Feedjirra. Any help would be greatly appreciated.

Strange behavior with acts_as_taggable_on's tagged_with method

Im trying to find all records that have similar tags to the currently viewed record.
My controller has:
def show
#tattoo =Tattoo.find(params[:id])
tags = #tattoo.style_list.join(", ")
#tattoos = Tattoo.tagged_with(tags, :any => true).limit(6)
end
(bonus points if anyone can tell me how to randomize the order of records in the arrary)
My view just loops through the array.
Anyway, it works almost all the time but I noticed it breaks occasionally and while troubleshooting I found that it breaks when I use tagged_with("jesse smith", :any => true) but it works when I try tagged_with("jason stephan", :any => true) or tagged_with("black ink", :any => true)
So each term has a space in it but for whatever reason 'jesse smith' kills the action.
My console shows that I have a routing error too:
ActionView::Template::Error (No route matches {:action=>"show", :controller=>"tattoos", :member_id=>nil, :id=>#<Tattoo id: 170, description: "", status: "approved", member_id: nil, created_at: "2011-10-25 23:08:17", updated_at: "2011-11-17 16:56:55", file_file_name: "starry-eyed-rabid-squirrelweb.jpg", file_content_type: "image/jpeg", file_file_size: 294782, file_updated_at: "2011-10-25 23:08:17", album_id: nil, position: 116, favorite_count: 0, share_count: 1, file_remote_url: "http://www.jessesmithtattoos.com/wp-content/gallery...">}):
22: <ol class="small_tattoos">
23: <% #tattoos.each do |t| %>
24: <li>
25: <%= link_to image_tag(t.file.url(:tiny),:alt=>"#{t.style_list}, rtattoos, tattoos"), member_tattoo_path(t.member, t) %>
26: </li>
27: <% end %>
28: </ol>
app/views/index/show.html.erb:25:in `block (2 levels) in _app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926'
app/views/index/show.html.erb:23:in `block in _app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926'
app/views/index/show.html.erb:11:in `_app_views_index_show_html_erb___1839804211534816245_69842632179360__4333294961394575926'
So why does the one term cause a routing error and not the others?
I guess you have problem with path helper:
member_tattoo_path(t.member, t)
I see in your error description that
:member_id=>nil
So it turns out that tattoo tagged with jesse smith hasn't corresponding association with name 'member', and path helper, which need valid id, throws exception.

Rails 3 Occasional Routing Error

I'm running Rails 3.1.1 and getting an odd bug. In development (haven't yet tried pushing to production with it) I'm occasionally getting routing errors in my controller or in my mailer template when it tries to generate a url for a newly created record. This happens even though the record is created successfully and appears to have nothing to do with the record properties (I can recreate a record with the exact same params right after and not get the error, it seems totally random when it happens).
It seems to happen maybe one in 10 times, though I can't say I ever saw an incident of it happening before I added the mailer action.
There's one more potentially complicating factor: I'm using an encryption method to obfuscate the record's id in its URL, but this is otherwise working without a hitch. To do this I adapted the method discussed here
It seems to me like the URL's not generated in time for the link_to call some of the time... But that doesn't make much sense to me. I didn't think race conditions were something I needed to worry about here.
Here are my error logs when this happens in the controller (when the params don't call for an email to be generated):
ActionController::RoutingError (No route matches {:action=>"show", :controller=>"watch_lists", :id=>#<WatchList id: 195, title: "sfdsfd", created_at: "2012-03-19 05:18:46", updated_at: "2012-03-19 05:18:46", public_list: false>}):
app/controllers/watch_lists_controller.rb:72:in `block (2 levels) in create'
app/controllers/watch_lists_controller.rb:56:in `create'
And here's when it happens in the mailer template (when the params do call for an email to be generated before the render command):
Rendered watch_list_mailer/share_notification.html.erb (3.2ms)
Completed 500 Internal Server Error in 113ms
ActionView::Template::Error (No route matches {:action=>"show", :controller=>"watch_lists", :id=>#<WatchList id: 210, title: "sdggsgsg", created_at: "2012-03-19 05:47:17", updated_at: "2012-03-19 05:47:17", public_list: true>}):
20: <% end %>
21: <% end %><br>
22: <br>
23: Here's a link to your WatchList: <%= link_to #wl.title, watch_list_url(#wl) %><br>
24: <br>
25: Enjoy!
26: </p>
app/views/watch_list_mailer/share_notification.html.erb:23:in `_app_views_watch_list_mailer_share_notification_html_erb___1391186431365383285_70156615518000'
app/mailers/watch_list_mailer.rb:12:in `share_notification'
app/controllers/watch_lists_controller.rb:124:in `share_notification'
app/controllers/watch_lists_controller.rb:68:in `block (2 levels) in create'
app/controllers/watch_lists_controller.rb:63:in `each'
app/controllers/watch_lists_controller.rb:63:in `block in create'
app/controllers/watch_lists_controller.rb:56:in `create'
EDIT: Upon further testing, this appears to happen regardless of whether I include the mail task. It seems most likely spurred by the obfuscation of the links. It's possible that the encoding of the links has something to do with it (I had to make sure to URI-escape them to prevent slashes in the wrong places elsewhere in my code). I'll investigate this futher and report back.
It was a problem with the id encryption creating invalid links occasionally and me failing to account for that in early enough in the process.
In lib/obfuscate.rb
def uri_encrypt(value)
URI.escape(self.encrypt(value), Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
In my model
def to_param
uri_encrypt(id)
end

Diagnosing Rails Application Hang on Element Update

In the course of building a rails application to help small hotels' manage bookings, I'm encountering a strange application hang. Building the reservation works fine; adding guests, assigning them to rooms, etc, without issue. However, when the merchant goes to 'confirm' an inquiry, Mongrel hangs me out to dry.
The index page for reservations lists the current inquiries and confirmed bookings:
# reservations/index.html.erb
<% unless #reservations.empty? %>
<h2>Inquiries</h2><hr/><br/>
<%= render :partial => 'reservation', :collection => #reservations.reject { |r| r.confirmed } %>
<h2>Confirmed Reservations</h2><hr/><br/>
<%= render :partial => 'reservation', :collection => #reservations.reject { |r| not r.confirmed } %>
<% else %>
<%= link_to 'Search for rooms', :action => 'index', :controller => 'search' %>
<% end %>
In the reservation partial itself, the bits which invoke the confirm/unconfirm logic are simply direct links to controller actions:
# _reservation.html.erb
(<% unless reservation.confirmed? %>
<%= link_to 'Confirm Reservation', :action => 'confirm', :id => reservation.id %>
<% else %>
<%= link_to 'Unconfirm Reservation', :action => 'unconfirm', :id => reservation.id %>
<% end %>)
The controller action to confirm a reservation, which is mapped to a PUT in my routes, looks like this:
def confirm
puts "\n\n\nConfirming reservation #{params[:id]}..."
#reservation = Reservation.find(params[:id])
puts "Found reservation! Confirming..."
#reservation[:confirmed] = true
puts "Confirmed, saving..."
respond_to do |wants|
if #reservation.save
flash[:notice] = 'Reservation has been confirmed.'
wants.html { redirect_to :action => 'index' }
else
wants.html { render :action => 'index' }
end
end
end
'#reservation.save' is what does the trick. Definite app hang every time.
Can someone help me understand just what is going on here?
/UPDATE:
From playing around with the console I was able to demonstrate the issue in another way:
?> r = Reservation.find(36)
=> #<Reservation id: 36, customer_name: "buyer", customer_email: "buyer#buy.com", begin: "2009-06-22 00:00:00", end: "2009-06-26 00:00:00", request_timestamp: nil, notes: "Thanks!", created_at: "2009-06-13 20:36:50", updated_at: "2009-06-13 20:36:50", yacht_id: 7, adults: 1, children: 0, buyer_id: 3, confirmed: nil>
>> r.confirmed = true
=> true
>> r
=> #<Reservation id: 36, customer_name: "buyer", customer_email: "buyer#buy.com", begin: "2009-06-22 00:00:00", end: "2009-06-26 00:00:00", request_timestamp: nil, notes: "Thanks!", created_at: "2009-06-13 20:36:50", updated_at: "2009-06-13 20:36:50", yacht_id: 7, adults: 1, children: 0, buyer_id: 3, confirmed: true>
>> r.save!
IRB::Abort: abort then interrupt!!
from C:/Ruby/lib/ruby/1.8/irb.rb:81:in `irb_abort'
from C:/Ruby/lib/ruby/1.8/irb.rb:247:in `signal_handle'
from C:/Ruby/lib/ruby/1.8/irb.rb:66:in `start'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:275:in `call'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:275:in `run_callbacks'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/callbacks.rb:344:in `callback'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/callbacks.rb:318:in `valid?'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:221:in `send'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:221:in `method_missing'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:906:in `validates_associated'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:906:in `collect'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:906:in `validates_associated'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:399:in `validates_each'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:396:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:396:in `validates_each'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:182:in `call'
... 2204 levels...
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in `run'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in `send'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in `run'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:276:in `run_callbacks'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:1029:in `valid_without_callbacks?'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/callbacks.rb:315:in `valid?'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:1018:in `save_without_dirty!'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/dirty.rb:87:in `save_without_transactions!'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:200:in `save!'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:182:in `transaction'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:200:in `save!'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:200:in `save!'
from (irb):5>>
Note that the console locked up as well, and I had to abort the save! command using Ctrl-C.
Why in the world would the save! be doing this?
/UPDATE:
Got it!!! It was in my model. I was trying to validate an association and I had gotten the has_many/belongs_to stuff backwards.
Thanks, everyone!
Your issue may be this:
#reservation[:confirmed] = true
You're directly updating the attributes hash, which is a little odd. Normally, you'd just update the attribute.
#reservation.confirmed = true
I've had odd issues before when I messed with the attribute hash. Booleans especially - maybe because there is some type coercion happening.
Use thin instead of mongrel. Post more details from your log. It doesn't just hang like that usually.

Resources