Changing a node attribute from another node


#1

Hi,

Is there a way to change an attribute of some node from recipe on another node?
When I use the set method on node object obtained via search method it
changes locally but doesn’t get saved in the DB.

Thanks!


#2

Once you have the Node object, you need to call save on it:

node = search(‘query’).first
node[“new_attribute”] = "hello from another node"
node.save

but in general nodes aren’t permitted to modify other nodes. To make
it work, you’d have to make that node’s API client an admin, which
isn’t something to do lightly. Maybe you can tell us more about your
use case to see if there’s an easier way to get the outcome you want?

Dan DeLeo

On Fri, Jul 30, 2010 at 2:14 AM, Alexander Smirnov
smirnov.alexander@gmail.com wrote:

Hi,

Is there a way to change an attribute of some node from recipe on another node?
When I use the set method on node object obtained via search method it
changes locally but doesn’t get saved in the DB.

Thanks!