This would let you get at Mongo document field names that don't work
as method names too.
-Kurt
On Apr 5, 9:49 pm, Durran Jordan <dur...@gmail.com> wrote:
> I see no reason not to go fully dynamic at this point as long as it's
> configurable... The initial thought was to retain some sort of usual
> behaviour with method missing but at this point I think we are all
> versed enough in mongodb to handle nils getting returned on random
> methods. I'll put a card in to update it.
>
> - Email von das Handy.
>
> On 05/04/2010, at 1:47, Vojto Rinik <vo...@rinik.net> wrote:
>
>
>
> > Hello,
>
> > I was wondering why there aren't really dynamic accessor methods:
>
> >http://github.com/durran/mongoid/blob/master/lib/mongoid/attributes.r...
- Email von das Handy.
> --
> To unsubscribe, reply using "remove me" as the subject.
write_attribute will work, and the second that attribute is there you
have a getter and a setter. I am willing to add the square brackets
accessors to alias read_attribute and write_attribute for a more
shorthand syntax - but I think it still may be too much to not check
on method_missing since it then messes with the contract that the
document model provides.
I'll repost this to the list for thoughts. I am still open for
discussion on what people think.
On 5 August 2010 23:23, Zilog <imp...@gmail.com> wrote:
> Hi, Just found this thread about dynamic attributes.
>
> It appears dynamic setters don't work even with allow_dynamic_fields
> active?
>
> Aok if that's the final decisionn since write_attribute works - just
> not was I was expecting from the conversation below.
>
> (rails3, edge mongoid)
>
> Let me know and many thanks for mongoid!
>
> -Z
>
>
> On Apr 6, 4:41 pm, Durran Jordan <dur...@gmail.com> wrote:
>> That's pretty much why I said it should remain configurable - you
>> could set use_dynamic_fields to false and go through read/
>> write_attribute when necessary and not run into the issue described.
>> (btw this is going to be a model level config option in 2.0.0.beta3
>> this week.
>>
>> - Email von das Handy.
>>
>> On 06/04/2010, at 18:11, Kurt <mrk...@gmail.com> wrote:
>>
>>
>>
>> > I think I'd prefer that they don't, actually. I'd much rather use
>> > index based access to get at all thedynamicthings than have random
>> > methods return nil. :)
>>
>> > This would let you get at Mongo document field names that don't work
>> > as method names too.
>>
>> > -Kurt
>>
>> > On Apr 5, 9:49 pm, Durran Jordan <dur...@gmail.com> wrote:
>> >> I see no reason not to go fullydynamicat this point as long as it's
>> >> configurable... The initial thought was to retain some sort of usual
>> >> behaviour with method missing but at this point I think we are all
>> >> versed enough in mongodb to handle nils getting returned on random
>> >> methods. I'll put a card in to update it.
>>
>> >> - Email von das Handy.
>>
>> >> On 05/04/2010, at 1:47, Vojto Rinik <vo...@rinik.net> wrote:
>>
>> >>> Hello,
>>
>> >>> I was wondering why there aren't reallydynamicaccessor methods:
>>
>> >>>http://github.com/durran/mongoid/blob/master/lib/mongoid/attributes.r
>> >>> ...
>>
>> >>> I tried to create a new document and change an attribute that wasn't
>> >>> defined
>> >>> anywhere before.
>>
>> >>> I'm trying to craft a trulydynamicCMS where documents (pages) each