As far as I know, this should append these headers to the response from Rails no matter what, right? I''ve checked in Fierbug in Fierfox 3.5.5 and I only see my usual headers. What might be getting in the way? #app/controllers/application_controller.rb class ApplicationController < ActionController::Base after_filter :cors def cors response.headers[''Access-Control-Allow-Origin''] == ''*'' response.headers[''Access-Control-Allow-Methods''] == ''POST, GET, PUT, DELETE, OPTIONS, HEAD'' response.headers[''Access-Control-Allow-Credentials''] == ''true'' response.headers[''Access-Control-Allow-Headers''] == ''X- PINGOTHER'' response.headers[''Access-Control-Max-Age''] == ''86400'' # 24 hours end end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
your way is correct. http://guides.rubyonrails.org/action_controller_overview.html#other-ways-to-use-filters 9.2.1 Setting Custom Headers If you want to set custom headers for a response then response.headers is the place to do it. The headers attribute is a hash which maps header names to their values, and Rails will set some of them automatically. If you want to add or change a header, just assign it to response.headers this way: response.headers["Content-Type"] = "application/pdf" 2009/12/7 CoolAJ86 <coolaj86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> As far as I know, this should append these headers to the response > from Rails no matter what, right? > > I''ve checked in Fierbug in Fierfox 3.5.5 and I only see my usual > headers. What might be getting in the way? > > #app/controllers/application_controller.rb > class ApplicationController < ActionController::Base > after_filter :cors > > def cors > response.headers[''Access-Control-Allow-Origin''] == ''*'' > response.headers[''Access-Control-Allow-Methods''] == ''POST, GET, > PUT, DELETE, OPTIONS, HEAD'' > response.headers[''Access-Control-Allow-Credentials''] == ''true'' > response.headers[''Access-Control-Allow-Headers''] == ''X- > PINGOTHER'' > response.headers[''Access-Control-Max-Age''] == ''86400'' # 24 hours > end > end > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- tommy xiao E-mail: xiaods(AT)gmail.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
In message <bbe1cc46-4b0b-4732-9478-2c21cce885e2-uBRcKNuhf71zDDYfc5BhFGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>, CoolAJ86 <coolaj86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes>As far as I know, this should append these headers to the response >from Rails no matter what, right? > >I''ve checked in Fierbug in Fierfox 3.5.5 and I only see my usual >headers. What might be getting in the way?Because this is Ruby, not C? Use = for assignment, not = Surely?>#app/controllers/application_controller.rb >class ApplicationController < ActionController::Base > after_filter :cors > > def cors > response.headers[''Access-Control-Allow-Origin''] == ''*'' > response.headers[''Access-Control-Allow-Methods''] == ''POST, GET, >PUT, DELETE, OPTIONS, HEAD'' > response.headers[''Access-Control-Allow-Credentials''] == ''true'' > response.headers[''Access-Control-Allow-Headers''] == ''X- >PINGOTHER'' > response.headers[''Access-Control-Max-Age''] == ''86400'' # 24 hours > end >end-- Dave English - Principal Software QA Engineer Fiscal Systems (Software) Ltd -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Both Ruby and C use the == operator to test that the rvalue equals the lvalue, as in: this_email_message == pedantic Ruby uses both = and => as assignment operators, depending on the situation. Of course this prompts the student to ask, are two assignment operators enough? On Dec 7, 3:48 am, Dave English <dave.e.engl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In message > <bbe1cc46-4b0b-4732-9478-2c21cce88...-uBRcKNuhf71zDDYfc5BhFGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>, > CoolAJ86 <coola...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes > > >As far as I know, this should append these headers to the response > >from Rails no matter what, right? > > >I''ve checked in Fierbug in Fierfox 3.5.5 and I only see my usual > >headers. What might be getting in the way? > > Because this is Ruby, not C? > > Use = for assignment, not => > Surely? > > >#app/controllers/application_controller.rb > >class ApplicationController < ActionController::Base > > after_filter :cors > > > def cors > > response.headers[''Access-Control-Allow-Origin''] == ''*'' > > response.headers[''Access-Control-Allow-Methods''] == ''POST, GET, > >PUT, DELETE, OPTIONS, HEAD'' > > response.headers[''Access-Control-Allow-Credentials''] == ''true'' > > response.headers[''Access-Control-Allow-Headers''] == ''X- > >PINGOTHER'' > > response.headers[''Access-Control-Max-Age''] == ''86400'' # 24 hours > > end > >end > > -- > Dave English - Principal Software QA Engineer > Fiscal Systems (Software) Ltd-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 Dec 7, 2:52 pm, Rick <richard.t.ll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Both Ruby and C use the == operator to test that the rvalue equals the > lvalue, as in: this_email_message == pedantic > > Ruby uses both = and => as assignment operators, depending on the > situation. Of course this prompts the student to ask, are two > assignment operators enough? >or how many equality operators are enough ( ==, .eql?, .equal?, ==(sort of)) Fred> On Dec 7, 3:48 am, Dave English <dave.e.engl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > In message > > <bbe1cc46-4b0b-4732-9478-2c21cce88...-uBRcKNuhf71zDDYfc5BhFGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>, > > CoolAJ86 <coola...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes > > > >As far as I know, this should append these headers to the response > > >from Rails no matter what, right? > > > >I''ve checked in Fierbug in Fierfox 3.5.5 and I only see my usual > > >headers. What might be getting in the way? > > > Because this is Ruby, not C? > > > Use = for assignment, not => > > Surely? > > > >#app/controllers/application_controller.rb > > >class ApplicationController < ActionController::Base > > > after_filter :cors > > > > def cors > > > response.headers[''Access-Control-Allow-Origin''] == ''*'' > > > response.headers[''Access-Control-Allow-Methods''] == ''POST, GET, > > >PUT, DELETE, OPTIONS, HEAD'' > > > response.headers[''Access-Control-Allow-Credentials''] == ''true'' > > > response.headers[''Access-Control-Allow-Headers''] == ''X- > > >PINGOTHER'' > > > response.headers[''Access-Control-Max-Age''] == ''86400'' # 24 hours > > > end > > >end > > > -- > > Dave English - Principal Software QA Engineer > > Fiscal Systems (Software) Ltd-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
> Use = for assignment, not =Thank you! What I needed was a fresh set of eyes! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.