Hello,
Why does it call send with a block which yields instead of just
passing the block to send directly (like it used to)?
# new way
def method_missing(method, *args)
if load_target
if block_given?
@target.send(method, *args) { |*block_args|
This patch (or one like it) also has the side benefit of being able to
simplify the generated code for ActionController. The :secret could be
uncommented by default, and the comment on the line above could be removed.
On Wed, Sep 3, 2008 at 12:29 AM, Tim Haines <[EMAIL PROTECTED]> wrote:
> I dec
No, sorry. I'm trying to _truly_ make an attribute private. I want
nobody but my instance (self) to be able to access this attribute.
There's nothing like attr_private to my knowledge, though, so I
declared private methods.
The problem is the basic order of the way ActiveRecord redefines :respo
On Tue, Sep 2, 2008 at 4:07 PM, James Rosen <[EMAIL PROTECTED]> wrote:
>
> Ok, but what about
>
> $ irb
> irb(main):001:0> class Foo
> irb(main):002:1> def bar
> irb(main):003:2> end
> irb(main):004:1> private:bar
> irb(main):005:1> end
> => Foo
> irb(main):006:0> Foo.new.respond_to? :bar
> => fal
Ok, but what about
$ irb
irb(main):001:0> class Foo
irb(main):002:1> def bar
irb(main):003:2> end
irb(main):004:1> private:bar
irb(main):005:1> end
=> Foo
irb(main):006:0> Foo.new.respond_to? :bar
=> false
-Gaius
On Tue, Sep 2, 2008 at 2:21 PM, Damian Janowski
<[EMAIL PROTECTED]> wrote:
>
> On
> class Foo < ActiveRecord::Base
>
> private
>
> # really protect attribute bar
> def bar
>read_attribute :bar
> end
> def bar=(val)
>write_attribute :bar, val
> end
>
> end
>
> Now Foo.new.respond_to?(:bar) really _should_ return false
respond_to? is a Ruby core object method, it's
On Tue, Sep 2, 2008 at 3:00 PM, Jonathan Weiss <[EMAIL PROTECTED]> wrote:
>> This is because the definition of :respond_to? checks
>> whether @attributes.include?(method_name), but doesn't take attribute
>> protection into account.
>>
>
> It doesn't check attributes, it checks the actual methods o
It _is_ a core Ruby object, with a contract defined in Object. The
problem is that Rails overrides that definition, accounting for
ActiveRecord attributes. (It _should_ override, since it overrides
method_missing.)
All I'm saying is that the override devined in
ActiveRecord::AttributeMethods is
> I would think that Foo.new.respond_to?(:bar) would be false, but it
> returns true.
It should be true as the Foo instance responds to a method called bar.
> This is because the definition of :respond_to? checks
> whether @attributes.include?(method_name), but doesn't take attribute
> protectio
Sorry, you're right. I phrased my question wrong. Let's try this:
class Foo < ActiveRecord::Base
private
# really protect attribute bar
def bar
read_attribute :bar
end
def bar=(val)
write_attribute :bar, val
end
end
Now Foo.new.respond_to?(:bar) really _should_ return fa
I have a model class
class Foo < ActiveRecord::Base
attr_protected :bar
end
I would think that Foo.new.respond_to?(:bar) would be false, but it
returns true. This is because the definition of :respond_to? checks
whether @attributes.include?(method_name), but doesn't take attribute
protection
On Mon, Sep 1, 2008 at 2:14 PM, 7rans <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> One of the fundamental methods share by both ActiveSupport and Facets
> is
> Hash#slice!. A few days ago, someone pointed out to me that the two
> libs
> in this case are not quite the same. Quote, "I got hosed by a lovel
Hi,
One of the fundamental methods share by both ActiveSupport and Facets
is
Hash#slice!. A few days ago, someone pointed out to me that the two
libs
in this case are not quite the same. Quote, "I got hosed by a lovely
bug
stemming from facets' and rails' slice! returning opposite things...
facet
I decided to have a go at this tonight. Patch attached at
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/957
I'm happy to hear any feedback on the patch - as it might have a broader
impact than I'm aware of with my limited experience hacking on rails source.
Cheers,
Tim.
On
> Would be a patch useful, if currently there are no ways, regarding
> this matter?
It sucks that this is inconsistent, but I think this is probably going
to be a pretty tough problem for you to solve with a patch. Because
the presence of an object in the has_many :through collection requires
th
Cheers Koz, I might have a poke around with it over the weekend and see if I
can come up with anything useful.
Tim.
On Tue, Sep 2, 2008 at 7:11 PM, Michael Koziarski <[EMAIL PROTECTED]>wrote:
>
> > I'm wondering if the secret param should ever be used when using the
> cookie
> > session store?
> I'm wondering if the secret param should ever be used when using the cookie
> session store? If not, should rails raise an error when configured with the
> cookie store and secret param?
Ideally yes, rails would raise an error when misconfigured like this.
I believe at present the presence or
17 matches
Mail list logo