Anybody no how to read the anchor of a request? I make an redirect_to like this: redirect_to :controller=>"foo" :action=>"index" :anchor=>"bar" then in action index,I try to read url like this: c=request.path_parameters[''controller''] ac=request.path_parameters[''action''] an=request.path_parameters[''anchor''] finally I get c and ac the value I want,but fail to get an Any thought?Thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
fanz wrote:> Anybody no how to read the anchor of a request? > I make an redirect_to like this: > redirect_to :controller=>"foo" :action=>"index" :anchor=>"bar" > then in action index,I try to read url like this: > c=request.path_parameters[''controller''] > ac=request.path_parameters[''action''] > an=request.path_parameters[''anchor''] > finally I get c and ac the value I want,but fail to get an > > Any thought?Thanks!You recieve the parameter by using params in your controller params[:controller] params[:action] params[:anchor] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
> You recieve the parameter by using params in your controller > > params[:controller] > params[:action] > params[:anchor] > > -- > Posted viahttp://www.ruby-forum.com/.I try your codes,but the result is the same,is it a bug? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You do not have permission to post to group rubyonrails-talk. You may need to join the group before being allowed to post, or this group may not be open to posting. Cheers, Zach Inglis → Blog -- http://www.zachinglis.com → Company -- http://www.lt3media.com → Portfolio -- http://portfolio.zachinglis.com On Jun 2, 2007, at 3:55 AM, fanz wrote:> > >> You recieve the parameter by using params in your controller >> >> params[:controller] >> params[:action] >> params[:anchor] >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > I try your codes,but the result is the same,is it a bug? > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Ooops, wrong copy and paste. How about you tell us WHAT anchor is returning. Nil? Are you sure anchor is set? Cheers, Zach Inglis → Blog -- http://www.zachinglis.com → Company -- http://www.lt3media.com → Portfolio -- http://portfolio.zachinglis.com On Jun 2, 2007, at 3:55 AM, fanz wrote:> > >> You recieve the parameter by using params in your controller >> >> params[:controller] >> params[:action] >> params[:anchor] >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > I try your codes,but the result is the same,is it a bug? > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Zach Inglis // LT3media wrote:> You do not have permission to post to group rubyonrails-talk. You > may need to > join the group before being allowed to post, or this group may not be > open to > posting. > > Cheers, > Zach Inglis > → Blog -- http://www.zachinglis.com > → Company -- http://www.lt3media.com > → Portfolio -- http://portfolio.zachinglis.comWho are you talking to? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
On Jun 2, 5:17 pm, Zach Inglis // LT3media <l...-w8tEHcFK2X5Wk0Htik3J/w@public.gmane.org> wrote:> Ooops, wrong copy and paste. > > How about you tell us WHAT anchor is returning. Nil? > > Are you sure anchor is set?I''m not so sure,but I try two ways to fire a request with an anchor: 1) I use browser to send something like: localhost.com/foo#bar 2) I also use redirect_to :controller=>"foo" :action=>"index" :anchor=>"bar" And I use logger.info(params[:anchor]) to monitor the result,and what I get is always a blank row.By the same time,I have logger.info(params[:controller]) get the right value there. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
and I also got a correct redirect url with an anchor I set,so I think the anchor is set at least by the redirect way. And I think the problem is params didn''t get it. The proof is when I use params.to_json,what i get is something like: {action: "index", controller: "foo"},but no anchor. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
fanz wrote:> and I also got a correct redirect url with an anchor I set,so I think > the anchor is set at least by the redirect way. And I think theTry to post your code here, so we can see what''s wrong :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 2, 4:43 am, Jamal Soueidan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> You recieve the parameter by using params in your controller> params[:anchor]Are you completely sure this works? As far as I know, browsers don''t pass anchor information in their requests, and my experimentation here seems to verify this. I don''t think it''s possible to read the anchor from the URL on the server (though you can set it there). --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
here''s my code of controller: class FooController < ApplicationController def o logger.info("i''m in o") logger.info(params[:controller]) logger.info(params[:action]) logger.info(params[:anchor]) logger.info(params.to_json) redirect_to (:action=>"a",:anchor=>"blabla") end def a logger.info("i''m in a") logger.info(params[:controller]) logger.info(params[:action]) logger.info(params[:anchor]) logger.info(params.to_json) respond_to do |format| format.html {render :text=> "hi"} end end end and i send a request in browser like:"localhost.3000/foo/o#kkk" and i get a hi response with a url:flocalhost.3000/foo/a#blabla --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
fanz wrote:> here''s my code of controller: > > and i send a request in browser like:"localhost.3000/foo/o#kkk" > > and i get a hi response with a url:flocalhost.3000/foo/a#blablaThose are not parameters #kkk and #blablah ?? and if you are not getting anything from params[:controller] and params[:action] then you have a problem with your framework. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I get the right value with params[:controller] and params[:action],but nothing with params[:anchor] i''think Bill Kocik is right, the reason is the browser won''t send anchor to the server --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---