I am in a SessionInfo trouble.

error message is
ActionDispatch::Session::SessionRestoreError (Session contains objects
whose class definition isn't available.
Remember to require the classes for all objects kept in the session.
(Original exception: uninitialized constant SessionInfo [NameError])

my first ajax call is using flexigrd to rails, this is
SessionRestoreError.
my second ajax call is using jquery using ajax to rails. this is
somtimes work, sometime doesn't work.

I use rails3.0.9, ruby1.9.2, jqeury, flexigrid and os is ubunt.

how do I make ajax call?

------------------
//view
// first ajax

<table id="group_flex1"></table>

<script type="text/javascript">
var csrfparam = $("meta[name='csrf-param']").attr("content");
var csrftoken = $("meta[name='csrf-token']").attr("content");

$(function() {
$(document).ajaxSend(function(e, xhr, options) {
var token = $("meta[name='csrf-token']").attr("content");
xhr.setRequestHeader("X-CSRF-Token", token);
});


$("#group_flex1").flexigrid({
url: url_group_grid,
dataType: 'json',
singleSelect: true,
colModel : [
{display: 'id', name : 'id', width : 30, sortable : true, align:
'left', hide: true},

// snip

],

// snip

params : [
{ name : '<%= :search_group_kbn.to_s %>', value : '<%=
@search_group_kbn %>'},
{ name : '<%= :search_mbr_kind_kbn.to_s %>', value : '<%=
@search_mbr_kind_kbn %>'},
{ name : '<%= :search_group_name.to_s %>', value : '<%=
@search_group_name %>'},
{ name : '<%= :search_rep_familyname.to_s %>', value : '<%=
@search_rep_familyname %>'},
{ name : '<%= :search_valid_chk.to_s %>', value : $
('#search_valid_chk').attr('checked')},
{ name : '<%= :group_action.to_s %>', value : '<%=
session[:group_action].to_s %>'},
{ name : '_method', value : 'POST'},
{ name : csrfparam, value : csrftoken}],
preProcess: procLink
}
);

------------------
//view
// second ajax

<%= csrf_meta_tag %>

// snip

$(function() {
$(document).ajaxSend(function(e, xhr, options) {
var token = $("meta[name='csrf-token']").attr("content");
xhr.setRequestHeader("X-CSRF-Token", token);
});
$(window).load(function() {
$.ajax({url: '<%= url_for :controller => "events", :action =>
"index2" %>'
, success: function(html){$
("#events_all_list").append(html);}});
});

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Frederick Cheung at Nov 11, 2011 at 9:50 am

    On Nov 11, 5:08 am, shon wrote:
    I am in a SessionInfo trouble.

    error message is
    ActionDispatch::Session::SessionRestoreError (Session contains objects
    whose class definition isn't available.
    Remember to require the classes for all objects kept in the session.
    (Original exception: uninitialized constant SessionInfo [NameError])

    my first ajax call is using flexigrd to rails, this is
    SessionRestoreError.
    my second ajax call is using jquery using ajax to rails. this is
    somtimes work, sometime doesn't work.

    I use rails3.0.9, ruby1.9.2, jqeury, flexigrid  and os is ubunt.

    how do I make ajax call?
    This has almost certainly nothing to do with ajax or your javascript
    but with what you are storing in your session. In general, storing
    complex objects in the session is a bad idea. As the error message
    says, if you do go down this down you'll need to ensure that the the
    classes for objects that might be in the session are already loaded.

    Fred

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Shon at Nov 15, 2011 at 1:10 pm
    HI I'm shon.
    Your advice is right. i changed the session to be simple. then it
    works fine.

    Thank you.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 11, '11 at 9:44a
activeNov 15, '11 at 1:10p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Shon: 2 posts Frederick Cheung: 1 post

People

Translate

site design / logo © 2021 Grokbase