Well, there is a lot of code that isn’t relevant, but here is the basic
setup:
route:
map.connect 'browse_content/:library_id/:album_id/:page',
:controller =>
‘view’, :action => ‘browse_content’,
:page => 1, :requirements => { :page => /\d{1,}/,
:album_id =>
/-?\d{1,}/, :library_id => /-?\d{1,}/ }
def browse_content
album_id= @params[‘album_id’].to_i if @params[‘album_id’]
library_id= @params[‘library_id’].to_i if @params[‘library_id’]
page_number= @params[‘page’].to_i
is_all_albums= (album_id.nil? or album_id == -1 or album_id == 0)
is_all_photos= (is_all_albums and (library_id.nil? or library_id ==
-1))
....other code...
if is_all_photos
render :partial => 'library/browse_all_content', :layout => false
elsif is_all_albums
render :partial => 'library/browse_content', :layout => false
else
render :partial => 'album/browse_content', :layout => false
end
end
here is the view:
Library ‘<%=h @library.title %>’
‘<%=h @album.title %>’ by <%= @library.user.fullname %>
Total photos: <%= @total %>
<% if @photo_pages.page_count > 1 %>
Page: <%= pagination_links_remote @photo_pages %>
<% end %>
I’m telling you, I don’t think all this code is relevent, because I get
an
error saying that I am trying to do nil.to_i on the 3rd line of the
browse_content method. So I know my ‘page’ parameter is not being set.
But
I’ve setup the routes to set page to 1 by default. Again, when I POST
this
is a problem, but when I GET, it is not. I really just want to make my
Ajax
requests GET instead of POST for this reason and for the fact that GETs
are
cached and POSTs are not.
Thanks, Ryan
View this message in context:
http://www.nabble.com/remote_function-posting--t1768936.html#a4852301
Sent from the RubyOnRails Users forum at Nabble.com.